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

class PrepareAsyncIndexForSecurityScansOnPipelineIdAndScanType < Gitlab::Database::Migration[2.1]
  INDEX_NAME = 'index_security_scans_on_pipeline_id_and_scan_type'

  disable_ddl_transaction!

  # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/402978
  def up
    prepare_async_index :security_scans, [:pipeline_id, :scan_type], name: INDEX_NAME
  end

  def down
    unprepare_async_index :security_scans, [:pipeline_id, :scan_type], name: INDEX_NAME
  end
end