summaryrefslogtreecommitdiff
path: root/db/post_migrate/20221206075631_add_unique_id_partition_id_index_to_ci_build.rb
blob: c3e7a5799d04bbe280d2274e80a0582401ec9ec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

class AddUniqueIdPartitionIdIndexToCiBuild < Gitlab::Database::Migration[2.1]
  TABLE_NAME = :ci_builds
  INDEX_NAME = :index_ci_builds_on_id_partition_id_unique
  COLUMNS = %i[id partition_id].freeze

  def up
    prepare_async_index(TABLE_NAME, COLUMNS, unique: true, name: INDEX_NAME)
  end

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