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

20221214105307_add_token_encrypted_partition_id_index_to_ci_build.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4c64e9b0e70314210b5e05b642b86be1446cddaa (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 AddTokenEncryptedPartitionIdIndexToCiBuild < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  TABLE_NAME = :ci_builds
  INDEX_NAME = :unique_ci_builds_token_encrypted_and_partition_id
  COLUMNS = %i[token_encrypted partition_id].freeze

  def up
    prepare_async_index(
      TABLE_NAME,
      COLUMNS,
      where: 'token_encrypted IS NOT NULL',
      unique: true,
      name: INDEX_NAME
    )
  end

  def down
    unprepare_async_index(TABLE_NAME, COLUMNS, name: INDEX_NAME)
  end
end