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

Improve transaction usage in beam-automigrate #48

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

madeline-os
Copy link
Contributor

@madeline-os madeline-os commented Aug 10, 2022

[x] Plan migration in the same transaction as the attempted execution
[x] Expose attempted migration without transaction so user can embed it in their own
[] unmangle the haddocks
[] make the README literate example not rely on unsafe stuff

At first, all I wanted to do was make sure that the main entry points were obviously guarded by a transaction, and expose unsafe entry points for the user to incorporate into their own larger migration logic (which should definitely be in a transaction). However, the top-level module was very large and sprawling, and I had to tease apart the functionality that didn't interact with the DB, and the part that did, so that I could make sure I didn't miss anything. So it goes.

@madeline-os madeline-os marked this pull request as draft August 10, 2022 01:41
The top-level module was a mix of code for munging and outputting
information about migrations, and code that actually executed
migrations. The former has been split out into
Database.Beam.AutoMigrate.Eval, and the latter into
Database.Beam.Automigrate.Unsafe.

The top-level module now exports migration executions that wrap
everything in a transaction, and the Unsafe module exports them without
the transaction wrapper: that's why they're extremely unsafe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant