Merge pull request #9134 from colinux/migrate-dossier-corrections-multiple-transactions
ETQ dev fix création des foreign keys de la création de la table `dossier_corrections`
This commit is contained in:
commit
08154d46d6
2 changed files with 15 additions and 2 deletions
|
@ -3,8 +3,10 @@ class CreateDossierCorrections < ActiveRecord::Migration[6.1]
|
|||
|
||||
def change
|
||||
create_table :dossier_corrections do |t|
|
||||
t.references :dossier, null: false, foreign_key: true
|
||||
t.references :commentaire, foreign_key: true
|
||||
# foreign keys are added in a later migration
|
||||
# see https://github.com/fatkodima/online_migrations#adding-multiple-foreign-keys
|
||||
t.references :dossier, null: false, foreign_key: false
|
||||
t.references :commentaire, foreign_key: false
|
||||
t.datetime :resolved_at, precision: 6
|
||||
|
||||
t.timestamps
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class AddForeignKeysToDossierCorrections < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_foreign_key :dossier_corrections, :dossiers, column: :dossier_id, validate: false
|
||||
validate_foreign_key :dossier_corrections, :dossiers
|
||||
|
||||
add_foreign_key :dossier_corrections, :commentaires, column: :commentaire_id, validate: false
|
||||
validate_foreign_key :dossier_corrections, :commentaires
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue