summaryrefslogtreecommitdiff
path: root/db/post_migrate/20221121000127_index_security_scans_on_created_at_and_id_for_non_purged_records.rb
blob: 0085005166f2efb54b50a82f09a01135da536c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class IndexSecurityScansOnCreatedAtAndIdForNonPurgedRecords < Gitlab::Database::Migration[2.0]
  INDEX_NAME = :index_security_scans_for_non_purged_records
  PURGED_STATE = 6

  disable_ddl_transaction!

  def up
    add_concurrent_index :security_scans, %w[created_at id], where: "status != #{PURGED_STATE}", name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :security_scans, INDEX_NAME
  end
end