From 8ed2c4f0b636543295e02aa3a880c83f7980b22c Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 21 Aug 2022 20:07:39 -0500 Subject: [PATCH] db: fix migration to drop ai_tags.tag_id index concurrently. Fix deadlock in production when trying to drop this index. --- .../20220627211714_add_tag_id_and_score_index_to_ai_tags.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb b/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb index c771e6393..a2f3ad5d4 100644 --- a/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb +++ b/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb @@ -1,6 +1,8 @@ class AddTagIdAndScoreIndexToAITags < ActiveRecord::Migration[7.0] + disable_ddl_transaction! + def change add_index :ai_tags, [:tag_id, :score], if_not_exists: true - remove_index :ai_tags, :tag_id + remove_index :ai_tags, :tag_id, algorithm: :concurrently, if_exists: true end end