mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-12 16:16:03 -05:00
Make some of 4.7 migrations more resilient to being interrupted (#40264)
This commit is contained in:
@@ -3,7 +3,13 @@
|
||||
class AddIndexAccountIdLocalFragmentToKeypair < ActiveRecord::Migration[8.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
def up
|
||||
add_index :keypairs, [:account_id, :local_fragment], unique: true, where: 'local_fragment IS NOT NULL', algorithm: :concurrently
|
||||
rescue ActiveRecord::StatementInvalid
|
||||
safety_assured { execute 'REINDEX INDEX CONCURRENTLY index_keypairs_on_account_id_and_local_fragment' }
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :keypairs, name: :index_keypairs_on_account_id_and_local_fragment
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
class AddNewIndexAccountIdLocalFragmentToKeypair < ActiveRecord::Migration[8.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
def up
|
||||
add_index :keypairs, [:account_id, :local_fragment], unique: true, name: :index_keypairs_on_account_id_and_local_fragment, algorithm: :concurrently
|
||||
rescue ActiveRecord::StatementInvalid
|
||||
safety_assured { execute 'REINDEX INDEX CONCURRENTLY index_keypairs_on_account_id_and_local_fragment' }
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :keypairs, name: :index_keypairs_on_account_id_and_local_fragment
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user