Skip to content

Commit

Permalink
[minor] Use symbol form of index name (#1171)
Browse files Browse the repository at this point in the history
* Use symbol form of index name

All the other indexes that use an explicit (non-generated) name use
symbols, except this one. This is for consistency. I've tested
that a version of this gem that includes this change, generates the Good
Jobs migration, and that the migration applies as expected.

* Fix up other inconsistencies

---------

Co-authored-by: Ben Sheldon [he/him] <[email protected]>
  • Loading branch information
andyatkinson and bensheldon authored Dec 8, 2023
1 parent 294e510 commit 02b954e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demo/db/migrate/20200224015928_create_good_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def change
t.timestamps
end

add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at"
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: :index_good_jobs_on_scheduled_at
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CreateGoodJobs < ActiveRecord::Migration<%= migration_version %>
t.index :key, unique: true
end

add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at"
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: :index_good_jobs_on_scheduled_at
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CreateGoodJobs < ActiveRecord::Migration<%= migration_version %>
t.jsonb :state
end

add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at"
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: :index_good_jobs_on_scheduled_at
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished
Expand Down

0 comments on commit 02b954e

Please sign in to comment.