diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-03-01 13:18:49 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-03-01 13:18:49 -0600 |
commit | e33c4d0f152345edd7498885a15b993a5885540d (patch) | |
tree | d58323d8ee4518b6e4a76dea77701108759617cb | |
parent | ec3bb41e383e0d3d229e84e0d71c215d31d1a502 (diff) |
check for indexes that might not exist
-rw-r--r-- | db/migrate/20200227214439_modify_status_index.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/db/migrate/20200227214439_modify_status_index.rb b/db/migrate/20200227214439_modify_status_index.rb index df8ca263a..2f4e98da5 100644 --- a/db/migrate/20200227214439_modify_status_index.rb +++ b/db/migrate/20200227214439_modify_status_index.rb @@ -1,9 +1,15 @@ class ModifyStatusIndex < ActiveRecord::Migration[5.2] def up remove_index :statuses, name: :index_statuses_20190820 - remove_index :statuses, name: :index_statuses_on_account_id_and_id_and_visibility_not_hidden + if index_exists? :statuses, name: :index_statuses_on_account_id_and_id_and_visibility_not_hidden + remove_index :statuses, name: :index_statuses_on_account_id_and_id_and_visibility_not_hidden + end + remove_index :statuses, name: :index_statuses_on_account_id_and_id_and_visibility - remove_index :statuses, name: :index_statuses_local_20190824 + + if index_exists? :statuses, name: :index_statuses_local_20190824 + remove_index :statuses, name: :index_statuses_local_20190824 + end safety_assured do add_index :statuses, [:account_id, :id, :visibility, :updated_at], where: '(deleted_at IS NULL) AND (NOT hidden)', order: { id: :desc }, name: :index_statuses_20200301 |