Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20230403190527_add_index_to_security_scans_on_scan_type.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b8a377e833c8b1bdea3e7a9639746631779e0843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

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

  TABLE_NAME = :security_scans
  INDEX_NAME = 'index_for_security_scans_scan_type'
  SUCCEEDED = 1

  def up
    add_concurrent_index TABLE_NAME, [:scan_type, :project_id, :pipeline_id], where: "status = #{SUCCEEDED}",
      name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
  end
end