fix: drop unused column and fk procedure_revisions.attestation_template_id which block procedure.destroy

This commit is contained in:
simon lehericey 2024-04-11 11:18:55 +02:00
parent ab4a6b1c7d
commit bda9c4b455
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
3 changed files with 8 additions and 5 deletions

View file

@ -1,5 +1,4 @@
class ProcedureRevision < ApplicationRecord
self.ignored_columns += [:attestation_template_id]
self.implicit_order_column = :created_at
belongs_to :procedure, -> { with_discarded }, inverse_of: :revisions, optional: false
belongs_to :dossier_submitted_message, inverse_of: :revisions, optional: true, dependent: :destroy

View file

@ -0,0 +1,7 @@
class DropAttestationTemplateIdFromProcedureRevisionsTable < ActiveRecord::Migration[7.0]
def up
safety_assured do
remove_column :procedure_revisions, :attestation_template_id
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2024_04_10_193614) do
ActiveRecord::Schema[7.0].define(version: 2024_04_11_091345) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_buffercache"
enable_extension "pg_stat_statements"
@ -853,13 +853,11 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_10_193614) do
end
create_table "procedure_revisions", force: :cascade do |t|
t.bigint "attestation_template_id"
t.datetime "created_at", precision: nil, null: false
t.bigint "dossier_submitted_message_id"
t.bigint "procedure_id", null: false
t.datetime "published_at", precision: nil
t.datetime "updated_at", precision: nil, null: false
t.index ["attestation_template_id"], name: "index_procedure_revisions_on_attestation_template_id"
t.index ["dossier_submitted_message_id"], name: "index_procedure_revisions_on_dossier_submitted_message_id"
t.index ["procedure_id"], name: "index_procedure_revisions_on_procedure_id"
end
@ -1253,7 +1251,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_10_193614) do
add_foreign_key "procedure_revision_types_de_champ", "procedure_revision_types_de_champ", column: "parent_id"
add_foreign_key "procedure_revision_types_de_champ", "procedure_revisions", column: "revision_id"
add_foreign_key "procedure_revision_types_de_champ", "types_de_champ"
add_foreign_key "procedure_revisions", "attestation_templates"
add_foreign_key "procedure_revisions", "dossier_submitted_messages"
add_foreign_key "procedure_revisions", "procedures"
add_foreign_key "procedures", "groupe_instructeurs", column: "defaut_groupe_instructeur_id"