mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-29 18:14:09 +00:00
Fix error re-running some migrations if they get interrupted at the wrong moment (#17989)
This commit is contained in:
parent
465ee7792f
commit
5f0fc639da
|
@ -813,6 +813,9 @@ module Mastodon
|
||||||
def update_index(table_name, index_name, columns, **index_options)
|
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)
|
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, "#{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
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
Loading…
Reference in a new issue