diff --git a/db/migrate/20251010233458_add_index_good_jobs_job_class.rb b/db/migrate/20251010233458_add_index_good_jobs_job_class.rb new file mode 100644 index 00000000..0adc63e2 --- /dev/null +++ b/db/migrate/20251010233458_add_index_good_jobs_job_class.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsJobClass < ActiveRecord::Migration[8.0] + disable_ddl_transaction! + + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.index_exists? :good_jobs, :job_class + end + end + + add_index :good_jobs, :job_class, algorithm: :concurrently + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 210f40b0..23d5e143 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_04_02_192110) do +ActiveRecord::Schema[8.0].define(version: 2025_10_10_233458) do # These are extensions that must be enabled in order to support this database enable_extension "citext" enable_extension "pg_catalog.plpgsql" @@ -120,6 +120,7 @@ t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at_cond", where: "(cron_key IS NOT NULL)" t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at_cond", unique: true, where: "(cron_key IS NOT NULL)" t.index ["finished_at"], name: "index_good_jobs_jobs_on_finished_at", where: "((retried_good_job_id IS NULL) AND (finished_at IS NOT NULL))" + t.index ["job_class"], name: "index_good_jobs_on_job_class" t.index ["labels"], name: "index_good_jobs_on_labels", where: "(labels IS NOT NULL)", using: :gin t.index ["locked_by_id"], name: "index_good_jobs_on_locked_by_id", where: "(locked_by_id IS NOT NULL)" t.index ["priority", "created_at"], name: "index_good_job_jobs_for_candidate_lookup", where: "(finished_at IS NULL)" diff --git a/test/lib/good_job_test.rb b/test/lib/good_job_test.rb new file mode 100644 index 00000000..e1e19865 --- /dev/null +++ b/test/lib/good_job_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GoodJobTest < ActiveSupport::TestCase + test 'has no pending migrations' do + assert GoodJob.migrated? + end +end