1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-23 22:56:20 +09:00

Fix migration error handling (#17991)

This commit is contained in:
Claire 2022-04-07 20:46:30 +02:00 committed by GitHub
parent 5f0fc639da
commit cb45c04d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -812,7 +812,7 @@ module Mastodon
# removing the old one
def update_index(table_name, index_name, columns, **index_options)
if index_name_exists?(table_name, "#{index_name}_new") && index_name_exists?(table_name, index_name)
remove_index table_name, "#{index_name}_new"
remove_index table_name, name: "#{index_name}_new"
elsif index_name_exists?(table_name, "#{index_name}_new")
# Very unlikely case where the script has been interrupted during/after removal but before renaming
rename_index table_name, "#{index_name}_new", index_name