From 253393f3a8281dcf5850aabd917da727518f49c4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 11 Dec 2023 03:04:45 -0500 Subject: [PATCH] Only attempt to remove indexes that exist in `CLI::Maintenance` script (#28286) --- lib/mastodon/cli/maintenance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index d0eff7da6..553ca056d 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -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