Skip to content

Commit

Permalink
Migration to allow nesting batches
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcamara committed Sep 26, 2024
1 parent b494353 commit 7c1c31d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/solid_queue/job_batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module SolidQueue
class JobBatch < Record
belongs_to :job, foreign_key: :job_id, optional: true
belongs_to :parent_job_batch, foreign_key: :parent_job_batch_id, class_name: "SolidQueue::JobBatch", optional: true
has_many :jobs, foreign_key: :batch_id

serialize :on_finish_active_job, coder: JSON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class CreateSolidQueueBatchTable < ActiveRecord::Migration[7.1]
def change
create_table :solid_queue_job_batches do |t|
t.references :parent_job_batch, index: true # FIXME: foreign key
t.text :on_finish_active_job
t.text :on_success_active_job
t.text :on_failure_active_job
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
end

create_table "solid_queue_job_batches", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "parent_job_batch_id"
t.text "on_finish_active_job"
t.text "on_success_active_job"
t.text "on_failure_active_job"
Expand All @@ -58,6 +59,7 @@
t.index ["changed_at"], name: "index_solid_queue_job_batches_on_changed_at"
t.index ["finished_at"], name: "index_solid_queue_job_batches_on_finished_at"
t.index ["last_changed_at"], name: "index_solid_queue_job_batches_on_last_changed_at"
t.index ["parent_job_batch_id"], name: "index_solid_queue_job_batches_on_parent_job_batch_id"
end

create_table "solid_queue_jobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
Expand Down

0 comments on commit 7c1c31d

Please sign in to comment.