Generate pgroll migration file from a current postgres schema
Is there any way to generate a pgroll migration file from an existing postgres, to be able to populate another postgres db?
If I for example would like to switch from flyway to pgroll, and just get an initial migration file?
1 Reply
Hi, currently pgroll is intended to manage a database's migrations lifecycle from the start. There isn't tooling (yet) to export an existing schema into pgroll migrations that can be applied to another target db.
For the purpose of creating a new db with pgroll enabled, the raw sql migration (https://github.com/xataio/pgroll/blob/main/docs/README.md#raw-sql) can be used to create the initial db state, taken from an origin db. This would still not create a pgroll migrations history for this operation, but it would initiate the database so pgroll can take over from there onwards.