summaryrefslogtreecommitdiff
path: root/db/migrate/20190828083843_add_index_to_ci_job_artifacts_on_project_id_for_security_reports.rb
blob: 5253f25aab461788e8e7f0f3e9f996d011539501 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class AddIndexToCiJobArtifactsOnProjectIdForSecurityReports < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :ci_job_artifacts,
                         :project_id,
                         name: "index_ci_job_artifacts_on_project_id_for_security_reports",
                         where: "file_type IN (5, 6, 7, 8)"
  end

  def down
    remove_concurrent_index :ci_job_artifacts,
                            :project_id,
                            name: "index_ci_job_artifacts_on_project_id_for_security_reports"
  end
end