File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
persistent-postgresql/test Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,14 @@ migrateManually = do
128128 , " ADD CONSTRAINT unique_user_id2"
129129 , " UNIQUE(user_id);"
130130 ]
131+ -- Add an extra redundant FK constraint on passwords_2.user_id, so that we
132+ -- can test that the migrator ignores it
133+ rawEx $
134+ T. concat
135+ [ " ALTER TABLE passwords_2"
136+ , " ADD CONSTRAINT duplicate_passwords_2_user_id_fkey"
137+ , " FOREIGN KEY (user_id) REFERENCES users(id);"
138+ ]
131139 rawEx $
132140 T. concat
133141 [ " CREATE TABLE admin_users("
@@ -371,6 +379,13 @@ spec = describe "MigrationSpec" $ do
371379 }
372380 ,
373381 [ ColumnReference
382+ { crTableName = EntityNameDB {unEntityNameDB = " users" }
383+ , crConstraintName =
384+ ConstraintNameDB {unConstraintNameDB = " duplicate_passwords_2_user_id_fkey" }
385+ , crFieldCascade =
386+ FieldCascade {fcOnUpdate = Just NoAction , fcOnDelete = Just NoAction }
387+ }
388+ , ColumnReference
374389 { crTableName = EntityNameDB {unEntityNameDB = " users" }
375390 , crConstraintName =
376391 ConstraintNameDB {unConstraintNameDB = " passwords_2_user_id_fkey" }
You can’t perform that action at this time.
0 commit comments