From 4ad3932c053e9c4596af79b5e8f7f4ed644e25fb Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 17 May 2018 15:31:45 +0200 Subject: [PATCH] Add test_procedure to procedure_path --- app/models/procedure_path.rb | 1 + .../20180516155238_add_test_procedure_to_procedure_paths.rb | 5 +++++ db/schema.rb | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb diff --git a/app/models/procedure_path.rb b/app/models/procedure_path.rb index 62dc924b3..bfe75ef04 100644 --- a/app/models/procedure_path.rb +++ b/app/models/procedure_path.rb @@ -3,6 +3,7 @@ class ProcedurePath < ApplicationRecord validates :administrateur_id, presence: true, allow_blank: false, allow_nil: false validates :procedure_id, presence: true, allow_blank: false, allow_nil: false + belongs_to :test_procedure, class_name: 'Procedure' belongs_to :procedure belongs_to :administrateur end diff --git a/db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb b/db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb new file mode 100644 index 000000000..fbc80c7d0 --- /dev/null +++ b/db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb @@ -0,0 +1,5 @@ +class AddTestProcedureToProcedurePaths < ActiveRecord::Migration[5.2] + def change + add_reference :procedure_paths, :test_procedure + end +end diff --git a/db/schema.rb b/db/schema.rb index 5b4dbd414..5cb37ac59 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: 2018_05_15_135415) do +ActiveRecord::Schema.define(version: 2018_05_16_155238) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -425,7 +425,9 @@ ActiveRecord::Schema.define(version: 2018_05_15_135415) do t.integer "administrateur_id" t.datetime "created_at" t.datetime "updated_at" + t.bigint "test_procedure_id" t.index ["path"], name: "index_procedure_paths_on_path" + t.index ["test_procedure_id"], name: "index_procedure_paths_on_test_procedure_id" end create_table "procedure_presentations", id: :serial, force: :cascade do |t|