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

20160803161903_add_unique_index_to_lists_label_id.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c1511963f78c613ea77300c1ca73fd7ce5d1cd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# rubocop:disable RemoveIndex
class AddUniqueIndexToListsLabelId < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :lists, [:board_id, :label_id], unique: true
  end

  def down
    remove_index :lists, column: [:board_id, :label_id] if index_exists?(:lists, [:board_id, :label_id], unique: true)
  end
end