Only attempt to remove indexes that exist in CLI::Maintenance script (#28286)

This commit is contained in:
Matt Jankowski 2023-12-11 03:04:45 -05:00 committed by GitHub
parent f5d6143aa1
commit 253393f3a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -712,7 +712,7 @@ module Mastodon::CLI
end
def remove_index_if_exists!(table, name)
ActiveRecord::Base.connection.remove_index(table, name: name)
ActiveRecord::Base.connection.remove_index(table, name: name) if ActiveRecord::Base.connection.index_name_exists?(table, name)
rescue ArgumentError, ActiveRecord::StatementInvalid
nil
end