From f280820201466b72ba2f91e7360961ebf6bbe4dc Mon Sep 17 00:00:00 2001 From: kara Diaby Date: Thu, 21 Jan 2021 14:57:57 +0100 Subject: [PATCH] Add unique index to Experts Procedures on expert <> procedure ids --- .../20210121134435_add_unique_index_to_experts_procedures.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20210121134435_add_unique_index_to_experts_procedures.rb diff --git a/db/migrate/20210121134435_add_unique_index_to_experts_procedures.rb b/db/migrate/20210121134435_add_unique_index_to_experts_procedures.rb new file mode 100644 index 000000000..965b5ba27 --- /dev/null +++ b/db/migrate/20210121134435_add_unique_index_to_experts_procedures.rb @@ -0,0 +1,5 @@ +class AddUniqueIndexToExpertsProcedures < ActiveRecord::Migration[6.0] + def change + add_index :experts_procedures, [:expert_id, :procedure_id], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 64ad0784a..46a02c5a3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_01_20_084256) do +ActiveRecord::Schema.define(version: 2021_01_21_134435) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -334,6 +334,7 @@ ActiveRecord::Schema.define(version: 2021_01_20_084256) do t.boolean "allow_decision_access", default: false, null: false t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.index ["expert_id", "procedure_id"], name: "index_experts_procedures_on_expert_id_and_procedure_id", unique: true t.index ["expert_id"], name: "index_experts_procedures_on_expert_id" t.index ["procedure_id"], name: "index_experts_procedures_on_procedure_id" end