A platform for community discussion. Free, open, simple.
PERF: Update migration to drop index concurrently. (#28955)
Alan Guo Xiang Tan02380af75cef
diff --git a/db/migrate/20240912061806_drop_trgm_indexes_on_users.rb b/db/migrate/20240912061806_drop_trgm_indexes_on_users.rbindex f31b33a21f6..6d1a0f25216 100644--- a/db/migrate/20240912061806_drop_trgm_indexes_on_users.rb+++ b/db/migrate/20240912061806_drop_trgm_indexes_on_users.rb@@ -1,9 +1,14 @@# frozen_string_literal: trueclass DropTrgmIndexesOnUsers < ActiveRecord::Migration[7.1]+ disable_ddl_transaction!+def upexecute <<~SQL- DROP INDEX IF EXISTS index_users_on_username_lower_trgm;- DROP INDEX IF EXISTS index_users_on_name_trgm;+ DROP INDEX CONCURRENTLY IF EXISTS index_users_on_username_lower_trgm;+ SQL++ execute <<~SQL+ DROP INDEX CONCURRENTLY IF EXISTS index_users_on_name_trgm;SQLend