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

20200826053152_add_index_on_ci_pipelines_source_for_on_demand_dast.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6249adc9798e0ebc431967bd0ee8adafae00bacb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

class AddIndexOnCiPipelinesSourceForOnDemandDast < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  INDEX_NAME = 'index_ci_pipelines_for_ondemand_dast_scans'

  SOURCE_ONDEMAND_DAST_SCAN_PIPELINE = 13

  disable_ddl_transaction!

  def up
    add_concurrent_index(
      :ci_pipelines, :id,
      where: "source = #{SOURCE_ONDEMAND_DAST_SCAN_PIPELINE}",
      name: INDEX_NAME
    )
  end

  def down
    remove_concurrent_index(
      :ci_pipelines, :id,
      where: "source = #{SOURCE_ONDEMAND_DAST_SCAN_PIPELINE}",
      name: INDEX_NAME
    )
  end
end