Add a unicity constraint on AssignTo

This commit is contained in:
gregoirenovel 2018-02-19 18:20:58 +01:00
parent 8902a81f23
commit deeda0e540
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
class AddUniqueIndexOnAssignTosGestionnaireIdProcedureId < ActiveRecord::Migration[5.2]
def change
add_index :assign_tos, [:gestionnaire_id, :procedure_id], unique: true
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_02_09_133452) do
ActiveRecord::Schema.define(version: 2018_02_19_170553) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -84,6 +84,7 @@ ActiveRecord::Schema.define(version: 2018_02_09_133452) do
create_table "assign_tos", id: :serial, force: :cascade do |t|
t.integer "gestionnaire_id"
t.integer "procedure_id"
t.index ["gestionnaire_id", "procedure_id"], name: "index_assign_tos_on_gestionnaire_id_and_procedure_id", unique: true
t.index ["gestionnaire_id"], name: "index_assign_tos_on_gestionnaire_id"
t.index ["procedure_id"], name: "index_assign_tos_on_procedure_id"
end