fix(migration): use strong migration to add fk without validation first, then apply fk validation

This commit is contained in:
Martin 2024-03-25 15:07:08 +01:00 committed by Eric Leroy-Terquem
parent b3d2ca1486
commit 82d70912c8
No known key found for this signature in database
GPG key ID: ECE60B4C1FA2ABB3
3 changed files with 7 additions and 1 deletions

View file

@ -1,5 +1,5 @@
class AddProcedureForeignKeyToBulkMessages < ActiveRecord::Migration[7.0]
def change
add_foreign_key :bulk_messages, :procedures
add_foreign_key :bulk_messages, :procedures, validate: false
end
end

View file

@ -0,0 +1,5 @@
class ValidateFkOnBulkMessage < ActiveRecord::Migration[7.0]
def change
validate_foreign_key :bulk_messages, :procedures
end
end

View file

@ -1209,6 +1209,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_03_25_160237) do
add_foreign_key "avis", "dossiers"
add_foreign_key "avis", "experts_procedures"
add_foreign_key "batch_operations", "instructeurs"
add_foreign_key "bulk_messages", "procedures"
add_foreign_key "bulk_messages_groupe_instructeurs", "bulk_messages"
add_foreign_key "bulk_messages_groupe_instructeurs", "groupe_instructeurs"
add_foreign_key "champs", "champs", column: "parent_id"