Commit a6d39980 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Add unique contrainst to labels association

parent 29b90ce8
...@@ -11,6 +11,8 @@ class CreateBoardFilterLabels < ActiveRecord::Migration ...@@ -11,6 +11,8 @@ class CreateBoardFilterLabels < ActiveRecord::Migration
t.integer :label_id, null: false, index: true t.integer :label_id, null: false, index: true
end end
add_index :board_filter_labels, [:board_filter_id, :label_id], unique: true
add_concurrent_foreign_key :board_filter_labels, :board_filters, column: :board_filter_id, on_delete: :cascade add_concurrent_foreign_key :board_filter_labels, :board_filters, column: :board_filter_id, on_delete: :cascade
add_concurrent_foreign_key :board_filter_labels, :labels, column: :label_id, on_delete: :cascade add_concurrent_foreign_key :board_filter_labels, :labels, column: :label_id, on_delete: :cascade
end end
......
...@@ -219,6 +219,7 @@ ActiveRecord::Schema.define(version: 20170921203824) do ...@@ -219,6 +219,7 @@ ActiveRecord::Schema.define(version: 20170921203824) do
t.integer "label_id", null: false t.integer "label_id", null: false
end end
add_index "board_filter_labels", ["board_filter_id", "label_id"], name: "index_board_filter_labels_on_board_filter_id_and_label_id", unique: true, using: :btree
add_index "board_filter_labels", ["board_filter_id"], name: "index_board_filter_labels_on_board_filter_id", using: :btree add_index "board_filter_labels", ["board_filter_id"], name: "index_board_filter_labels_on_board_filter_id", using: :btree
add_index "board_filter_labels", ["label_id"], name: "index_board_filter_labels_on_label_id", using: :btree add_index "board_filter_labels", ["label_id"], name: "index_board_filter_labels_on_label_id", using: :btree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment