summaryrefslogtreecommitdiff
path: root/db/migrate/20220512020500_index_batched_migrations_on_gitlab_schema_and_configuration.rb
blob: 077a60856cd0280981f0cc1945df1bcb222a582f (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 IndexBatchedMigrationsOnGitlabSchemaAndConfiguration < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  TABLE_NAME = :batched_background_migrations
  INDEX_NAME = 'index_batched_migrations_on_gl_schema_and_unique_configuration'

  def up
    add_concurrent_index TABLE_NAME,
      %i[gitlab_schema job_class_name table_name column_name job_arguments],
      unique: true,
      name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
  end
end