pg-schema-diff icon indicating copy to clipboard operation
pg-schema-diff copied to clipboard

[Question] Why not use `pg_dump --schema-only` to populate temporary database?

Open aleclarson opened this issue 1 year ago • 3 comments

I've been facing some frustrating issues with the temporary database. Specifically, composite types aren't copied into it, leading to failed setup within assertValidPlan.

Instead of generating migration statements to setup the temporary database, we should dump every schema returned by fetchNamedSchemas and run those dump files on the temporary database.

aleclarson avatar Sep 04 '24 03:09 aleclarson

I'm going to add a --temp-db flag that pg-schema-diff will use instead of creating its own. This will allow me to workaround this issue in the meantime. Let me know if you'd like me to open a PR with that flag.

aleclarson avatar Sep 04 '24 03:09 aleclarson

I strongly recommend skipping plan validation (it's a flag). pg-schema-diff inherently relies on being to diff(empty db, your source db schema). So if your source db contains any schema objects that aren't supported, it will break

Navbryce avatar Sep 04 '24 04:09 Navbryce

It doesn't use pg_dump because many hosts don't have pg_dump or support for libpq. I'd be open to adding support it for hosts that have it installed.

Navbryce avatar Sep 04 '24 04:09 Navbryce