You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add missing options to duplicated FK constraints (#671)
The new options in FK constraints (on update action, match type, etc.)
were missing from the duplication process. Thus, the options set
in the constraint disappeared after modifying columns with foreign
key constraints.
"single-column FK with single column duplicated": {
116
116
columns: []string{"city"},
117
117
expectedStmts: []string{
118
-
`ALTER TABLE "test_table" ADD CONSTRAINT "_pgroll_dup_fk_city" FOREIGN KEY ("_pgroll_new_city") REFERENCES "cities" ("id") ON DELETE NO ACTION`,
118
+
`ALTER TABLE "test_table" ADD CONSTRAINT "_pgroll_dup_fk_city" FOREIGN KEY ("_pgroll_new_city") REFERENCES "cities" ("id") MATCH SIMPLE ON DELETE NO ACTION ON UPDATE NO ACTION`,
119
119
},
120
120
},
121
121
"single-column FK with multiple columns duplicated": {
122
122
columns: []string{"city", "description"},
123
123
expectedStmts: []string{
124
-
`ALTER TABLE "test_table" ADD CONSTRAINT "_pgroll_dup_fk_city" FOREIGN KEY ("_pgroll_new_city") REFERENCES "cities" ("id") ON DELETE NO ACTION`,
124
+
`ALTER TABLE "test_table" ADD CONSTRAINT "_pgroll_dup_fk_city" FOREIGN KEY ("_pgroll_new_city") REFERENCES "cities" ("id") MATCH SIMPLE ON DELETE NO ACTION ON UPDATE NO ACTION`,
125
125
},
126
126
},
127
127
"multi-column FK with single column duplicated": {
0 commit comments