diff --git a/db/primary_migrate/20210809203128_drop_good_jobs_main_database.rb b/db/primary_migrate/20210809203128_drop_good_jobs_main_database.rb new file mode 100644 index 00000000000..6d0dd369847 --- /dev/null +++ b/db/primary_migrate/20210809203128_drop_good_jobs_main_database.rb @@ -0,0 +1,24 @@ +class DropGoodJobsMainDatabase < ActiveRecord::Migration[6.1] + def change + drop_table :good_jobs, id: :uuid do |t| + t.text :queue_name + t.integer :priority + t.jsonb :serialized_params + t.timestamp :scheduled_at + t.timestamp :performed_at + t.timestamp :finished_at + t.text :error + + t.timestamps + + t.uuid :active_job_id + t.text :concurrency_key + t.text :cron_key + + t.index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at" + t.index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at + t.index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at + t.index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished + t.index :good_jobs, [:cron_key, :created_at], name: :index_good_jobs_on_cron_key_and_created_at end + end +end diff --git a/db/schema.rb b/db/schema.rb index dc886f447fe..86fe94b3e6a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -258,26 +258,6 @@ t.index ["user_id", "created_at"], name: "index_events_on_user_id_and_created_at" end - create_table "good_jobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.text "queue_name" - t.integer "priority" - t.jsonb "serialized_params" - t.datetime "scheduled_at" - t.datetime "performed_at" - t.datetime "finished_at" - t.text "error" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.uuid "active_job_id" - t.text "concurrency_key" - t.text "cron_key" - t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at" - t.index ["concurrency_key"], name: "index_good_jobs_on_concurrency_key_when_unfinished", where: "(finished_at IS NULL)" - t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at" - t.index ["queue_name", "scheduled_at"], name: "index_good_jobs_on_queue_name_and_scheduled_at", where: "(finished_at IS NULL)" - t.index ["scheduled_at"], name: "index_good_jobs_on_scheduled_at", where: "(finished_at IS NULL)" - end - create_table "iaa_gtcs", force: :cascade do |t| t.string "gtc_number", null: false t.integer "mod_number", default: 0, null: false