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

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

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

  DOWNTIME = false

  disable_ddl_transaction!

  INCIDENT_ISSUE_TYPE = 1
  INDEX_NAME = 'index_issues_project_id_issue_type_incident'

  def up
    add_concurrent_index :issues, :project_id, where: "issue_type = #{INCIDENT_ISSUE_TYPE}", name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name(:issues, INDEX_NAME)
  end
end