I believe there are patterns that always work, but might not be optimal for all circumstances.
Eg. you could have a mirror table that you keep in sync with triggers without any constraints or foreign keys, do the migration on it, and then switch them around when ready.