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

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

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

  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false
  INDEX_NAME = 'index_clusters_on_enabled_cluster_type_id_and_created_at'

  disable_ddl_transaction!

  def up
    add_concurrent_index :clusters, [:enabled, :cluster_type, :id, :created_at], name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :clusters, INDEX_NAME
  end
end