Complete application database OST workflow
Hi,
I'm trying to use
pgroll
to introduce OST to postgresql database. This database is for Django application. I need help to understand how I can use pgroll
in the development workflow?5 Replies
Pgroll is a standalone migration system that doesn't interoperate (for now) with other migration systems like Django or ORMs. Pgroll is intended to fully manage the migration lifecycle of a Postgres schema.
You can check out the Tutorial here https://github.com/xataio/pgroll/blob/main/docs/README.md#tutorial to get started with pgroll. Compatibility with the Django model would need to be ensured "externally", meaning that pgroll needs to run all the migrations and django models be made to work with the schema without actually applying migrations
GitHub
pgroll/docs/README.md at main · xataio/pgroll
PostgreSQL zero-downtime migrations made easy. Contribute to xataio/pgroll development by creating an account on GitHub.
Thanks for the reply @kostas
I also found this repo https://github.com/xataio/pgroll-demo
It gives nice example on how to use pgroll with application deployment.
I have a follow-up question. After the migration is done, I need to modify the
search path
in the app v2. This means I need to deploy it again. Am I right?
Let me explain how I imagine the workflow:GitHub
GitHub - xataio/pgroll-demo: A demo application for pgroll
A demo application for pgroll. Contribute to xataio/pgroll-demo development by creating an account on GitHub.
1. Start the migration using pgroll.
2. Deploy the new version of the application that uses the schema generated by pgroll.
3. After you finish the deployment, complete the pgroll migration.
4. Re-deploy the application to start using the default schema.
Pgroll's intended workflow is to leave the schema of the latest migration as the current "active" one. So the app doen’t need to be redeployed to go back to using the public/default schema, it is rather going to run against the latest pgroll schema at any point in time.
Glad you already found the demo repo, the live demo here: https://www.youtube.com/watch?v=Fcs-lmrVOQM starting at around the 10m mark showcases the process more clearly.
Xata
YouTube
Zero-downtime and reversible schema migrations with pgroll
pgroll (https://github.com/xataio/pgroll) is an open source command-line tool that offers safe and reversible schema migrations for PostgreSQL by serving multiple schema versions simultaneously. It takes care of the complex migration operations to ensure that client applications continue working while the database schema is being updated. This i...