summaryrefslogtreecommitdiff
path: root/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb')
-rw-r--r--db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb b/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb
new file mode 100644
index 00000000000..6c2f9cbcb32
--- /dev/null
+++ b/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class DropTmpIndexOnEmailsAgain < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ EMAIL_INDEX_NAME = 'tmp_index_for_email_unconfirmation_migration'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:emails, EMAIL_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:emails, :id, where: 'confirmed_at IS NOT NULL', name: EMAIL_INDEX_NAME)
+ end
+end