rename switchman_shards foreign key as appropriate

it may have been created with an old name, so make it consistent

Change-Id: I9354d26929914baf6b4a276c2fcebfc2aa18aee4
Reviewed-on: https://gerrit.instructure.com/150132
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2018-05-14 08:28:44 -06:00
parent 92121d4015
commit 02145ee950
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
class RenameSwitchmanShardsFkIfNecessary < ActiveRecord::Migration[5.1]
tag :predeploy
def up
if connection.send(:postgresql_version) >= 90400
alter_constraint(:switchman_shards, find_foreign_key(:switchman_shards, :switchman_shards, column: :delayed_jobs_shard_id), new_name: 'fk_rails_45bd80a9c8')
else
remove_foreign_key_if_exists :switchman_shards, :switchman_shards, column: :delayed_jobs_shard_id
add_foreign_key :switchman_shards, :switchman_shards, column: :delayed_jobs_shard_id
end
end
end