summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220111093534_remove_index_on_auto_stop_in.rb
blob: bcb78b283765123c5749c96655478f5eac8358cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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