When diffing two databases with the following particularities :
The newer has new tables
Some new tables are referencing new tables
Some referenced new tables have unique constraints (not primary keys) referenced
apgdiff creates a script with ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ...
before CREATE UNIQUE INDEX ...
This leads to errors when executing the script (no unique contraint on referenced column or something like that).
Mitigation proposed :
Enforce ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ... to be inserted at the end of script
or
Enforce ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ... to be inserted before CREATE UNIQUE INDEX ... in the script.
I am sorry, I don't have time to prepare some usable examples.
If it would be helpful, I can do up an example. Although I think the solution is pretty simple, as @sholan said. We just need the FOREIGN KEYs to come after the UNIQUEs.
When diffing two databases with the following particularities :
apgdiff creates a script with ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ... before CREATE UNIQUE INDEX ...
This leads to errors when executing the script (no unique contraint on referenced column or something like that).
Mitigation proposed : Enforce ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ... to be inserted at the end of script or Enforce ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ... to be inserted before CREATE UNIQUE INDEX ... in the script.
I am sorry, I don't have time to prepare some usable examples.
Regards,