Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all logic into a single query? #51

Open
JAForbes opened this issue Jun 14, 2024 · 0 comments
Open

Move all logic into a single query? #51

JAForbes opened this issue Jun 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@JAForbes
Copy link
Owner

It would be cool if pgmg gathered up the migration files and fed the metadata into a query that produced a result set for the entire "plan" for the migration.

Then pgmg just iterates through that plan and blindly runs the plan as ordered.

That would make pgmg a very small side effectful wrapper around a pure query. That should make it a lot easier to test lots of permutations without needing to actually run any effects. And it would allow pgmg to give the user a lot more feedback on what it is about to do before it does it. A bit like terraform's plan / apply. It could give us all a lot more confident in running production migrations if the exact plan could be previewed prior to running anything.

Finally there's the chatty aspect (#41), this approach would lead to a single message being sent to and from the database (aside from the users actual migration logic). So running a simple migration from a Github Actions runner in the US with a db in Sydney wouldn't cause much overhead. It would be 1 query x 100ms instead of 3 or 4 queries per migration * 100ms.

@JAForbes JAForbes added the enhancement New feature or request label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant