diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-03 14:21:22 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-17 12:58:58 -0300 |
commit | c14ac835756d1d0f4d0f8279759e2b7f75364447 (patch) | |
tree | 925000dd60d64676eb76b8d4830ee7a9001a9a4f /db/migrate | |
parent | c08a14c3c20de35018a36f89dec0b10c99a4fd86 (diff) | |
download | gitlab-ce-c14ac835756d1d0f4d0f8279759e2b7f75364447.tar.gz |
Ensure that we have only one list per label per board
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb b/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb new file mode 100644 index 00000000000..baf2e70b127 --- /dev/null +++ b/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb @@ -0,0 +1,15 @@ +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 |