summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb')
-rw-r--r--db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb b/db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb
new file mode 100644
index 00000000000..bcb78b28376
--- /dev/null
+++ b/db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnAutoStopIn < Gitlab::Database::Migration[1.0]
+ TABLE = :environments
+ INDEX_NAME = 'index_environments_on_auto_stop_at'
+ COLUMN = :auto_stop_at
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index TABLE, COLUMN, where: 'auto_stop_at IS NOT NULL', name: INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index TABLE, COLUMN, where: 'auto_stop_at IS NOT NULL', name: INDEX_NAME
+ end
+end