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

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

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

  DOWNTIME = false
  INDEX_NAME = 'idx_issues_on_health_status_not_null'

  disable_ddl_transaction!

  def up
    add_concurrent_index(
      :issues,
      :health_status,
      where: 'health_status IS NOT NULL',
      name: INDEX_NAME
    )
  end

  def down
    remove_concurrent_index_by_name(:issues, INDEX_NAME)
  end
end