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
A multi-table SQL export writes tables in whatever order the tree lists them. Importing that file into a database with foreign keys enabled fails on the first child row whose parent is not there yet. The Disable foreign key checks option papers over it, but it needs a privilege on PostgreSQL and it is off for engines that ignore it.
Proposed solution
Topologically sort tables by foreign key dependency before writing, parents first.
On a cycle, fall back to the current order and say so in the export summary rather than writing something that cannot import.
Keep the existing behaviour of adding foreign keys with ALTER TABLE ... ADD CONSTRAINT after the data, so the two paths agree.
Alternatives considered
Reorder the file by hand, or disable foreign key checks and hope.
Activity
feat(plugins)!: order SQL exports by foreign key dependency and repor…