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

20231128111550_add_async_indexes_with_partition_id_for_ci_pipeline_variables.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9539bbcca3178261a1c21a2f90c1529c24baadc7 (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 AddAsyncIndexesWithPartitionIdForCiPipelineVariables < Gitlab::Database::Migration[2.2]
  milestone '16.7'

  TABLE_NAME = :ci_pipeline_variables
  PK_INDEX_NAME = :index_ci_pipeline_variables_on_id_partition_id_unique
  UNIQUE_INDEX_NAME = :index_pipeline_variables_on_pipeline_id_key_partition_id_unique

  def up
    prepare_async_index TABLE_NAME, %i[id partition_id], name: PK_INDEX_NAME, unique: true
    prepare_async_index TABLE_NAME, %i[pipeline_id key partition_id], name: UNIQUE_INDEX_NAME, unique: true
  end

  def down
    unprepare_async_index TABLE_NAME, %i[id partition_id], name: PK_INDEX_NAME, unique: true
    unprepare_async_index TABLE_NAME, %i[pipeline_id key partition_id], name: UNIQUE_INDEX_NAME, unique: true
  end
end