summaryrefslogtreecommitdiff
path: root/db/migrate/20230228092612_add_index_next_over_limit_check_at_asc_order_synchronously.rb
blob: a811b67bb4394747f4f2996388147f6c3a054344 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class AddIndexNextOverLimitCheckAtAscOrderSynchronously < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  TABLE_NAME = 'namespace_details'
  INDEX_NAME = 'index_next_over_limit_check_at_asc_order'
  COLUMN = 'next_over_limit_check_at'

  def up
    add_concurrent_index TABLE_NAME, COLUMN, name: INDEX_NAME, order: { next_over_limit_check_at: 'ASC NULLS FIRST' }
  end

  def down
    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
  end
end