Skip to content

Commit

Permalink
Merge pull request cloudfoundry#3650 from sap-contributions/change-de…
Browse files Browse the repository at this point in the history
…layed-jobs-reserve-index

Change delayed_jobs_reserve index
  • Loading branch information
philippthun authored Feb 26, 2024
2 parents 0906849 + 1077bae commit 4ac994f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions db/migrations/20240222131500_change_delayed_jobs_reserve_index.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Sequel.migration do
up do
if database_type == :postgres
drop_index :delayed_jobs, nil, name: :delayed_jobs_reserve, options: %i[if_exists concurrently]
add_index :delayed_jobs, %i[queue locked_at locked_by failed_at run_at priority],
where: { failed_at: nil }, name: :delayed_jobs_reserve, options: %i[if_not_exists concurrently]
end
end

down do
if database_type == :postgres
drop_index :delayed_jobs, nil, name: :delayed_jobs_reserve, options: %i[if_exists concurrently]
add_index :delayed_jobs, %i[queue locked_at locked_by failed_at run_at priority],
name: :delayed_jobs_reserve, options: %i[if_not_exists concurrently]
end
end
end

0 comments on commit 4ac994f

Please sign in to comment.