From d9dea779ea6c173445a07dbbe7c0b01e7b16d44e Mon Sep 17 00:00:00 2001 From: kara Diaby Date: Tue, 17 Nov 2020 13:46:13 +0100 Subject: [PATCH] Remove foreign key dossier on dossier operations logs --- app/models/dossier.rb | 2 +- ...0201117122923_remove_dossier_operation_log_foreign_key.rb | 5 +++++ db/schema.rb | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20201117122923_remove_dossier_operation_log_foreign_key.rb diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 7c4ddc06e..beefeb48e 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -74,7 +74,7 @@ class Dossier < ApplicationRecord has_many :avis, inverse_of: :dossier, dependent: :destroy has_many :traitements, -> { order(:processed_at) }, inverse_of: :dossier, dependent: :destroy - has_many :dossier_operation_logs, -> { order(:created_at) }, dependent: :nullify, inverse_of: :dossier + has_many :dossier_operation_logs, -> { order(:created_at) }, inverse_of: :dossier belongs_to :groupe_instructeur, optional: false belongs_to :revision, class_name: 'ProcedureRevision', optional: false diff --git a/db/migrate/20201117122923_remove_dossier_operation_log_foreign_key.rb b/db/migrate/20201117122923_remove_dossier_operation_log_foreign_key.rb new file mode 100644 index 000000000..b472d7a7e --- /dev/null +++ b/db/migrate/20201117122923_remove_dossier_operation_log_foreign_key.rb @@ -0,0 +1,5 @@ +class RemoveDossierOperationLogForeignKey < ActiveRecord::Migration[6.0] + def change + remove_foreign_key :dossier_operation_logs, :dossiers + end +end diff --git a/db/schema.rb b/db/schema.rb index 1d51fe378..398f529b7 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: 2020_11_10_155516) do +ActiveRecord::Schema.define(version: 2020_11_17_122923) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -709,7 +709,6 @@ ActiveRecord::Schema.define(version: 2020_11_10_155516) do add_foreign_key "closed_mails", "procedures" add_foreign_key "commentaires", "dossiers" add_foreign_key "dossier_operation_logs", "bill_signatures" - add_foreign_key "dossier_operation_logs", "dossiers" add_foreign_key "dossier_operation_logs", "instructeurs" add_foreign_key "dossiers", "groupe_instructeurs" add_foreign_key "dossiers", "procedure_revisions", column: "revision_id"