20160803161903_add_unique_index_to_lists_label_id.rb 416 Bytes
Newer Older
1
# rubocop:disable RemoveIndex
2
class AddUniqueIndexToListsLabelId < ActiveRecord::Migration[4.2]
3 4 5 6 7 8 9 10 11 12 13 14 15 16
  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