Foreign key issues
jmeyer
Posts: 70 Bronze 2
It looks like foreign keys are not being dropped if they are referencing an index and the index needs to be dropped. My settings do specify that foreign keys should be disabled
Comments
Thanks for contacting us and sorry you are having this issue!
If the primary key, index, or unique constraint is the comparison key, it can't be dropped. https://documentation.red-gate.com/disp ... ct+options
That said - what version are you using currently (11.x.x.x)?
Would you mind sending in an example of this issue?
Thanks!
Technical Sales Engineer
Redgate Software
Reproduction: code for the destination system including data destruction to trigger data sync
Deployment script being generated, please note that the foreign key is being disabled but he unique key is supposed to be dropped, this is what is then causing the failure
I am using options "Disable foreign keys" and "Drop primary keys, indexes, and unique constraints" enabled.
Anyway, yes, if I do not enable to option to drop/recreate indexes it will work. However, if I do enable to drop/recreate indexes then SQL DataCompare should be smart enough to then also drop/create/check the corresponding foreign keys instead of disable/enable.
And the reason I prefer to drop/create indexes is that I regularly insert/update/delete millions of records via SQL DataCompare and I do not want the indexes to be updated for every single insert/update/delete statement and potentially run into issues with unique constraints or unique indexes.
It looks complicated!