Skip to content

Commit

Permalink
Fix error re-running some migrations if they get interrupted at the w…
Browse files Browse the repository at this point in the history
…rong moment (#17989)
  • Loading branch information
ClearlyClaire committed Apr 7, 2022
1 parent 465ee77 commit 5f0fc63
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mastodon/migration_helpers.rb
Expand Up @@ -813,6 +813,9 @@ def column_for(table, name)
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"
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

begin
Expand Down

0 comments on commit 5f0fc63

Please sign in to comment.