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

Add migrate & unmigrate core helpers #250

Merged
merged 5 commits into from
Apr 20, 2024

Conversation

jayvdb
Copy link
Collaborator

@jayvdb jayvdb commented Apr 20, 2024

These helpers could be placed on Migrations or on BackendConnection, but it feels sensible to keep them separate and use these helpers to join them. Keen to reconsider that.

My reason for keeping them simple is anyone invoking these helpers can also play with the connection and migrations in advance, either to detect any problems in advance, or after, and editing the migrations to control the start / end of the migrate/rollback operations.

I'm also not keen on trying to use these helpers in butane_cli, as it would require moving a lot of CLI-ish feedback into an Err, but I am happy to do that - probably by creating a new Error enum for this.

@jayvdb jayvdb marked this pull request as ready for review April 20, 2024 02:33
@jayvdb jayvdb requested a review from Electron100 April 20, 2024 02:33
@Electron100
Copy link
Owner

Thanks for adding this, I too had been noticing it would be useful.
I think I would vote for placing these methods on Migrations because of the parallelism with apply on Migration. You can apply a single Migration, or migrate a whole Migrations collection.
It's also slightly more ergonomic to use with

migrations.migrate(&mut connection)

vs

migrations::migrate(&mut connection, &migrations)

I could also see naming the method apply_all or apply_unapplied, but very much don't feel strongly.

@jayvdb jayvdb changed the title Add migrate & rollback core helpers Add migrate & unmigrate core helpers Apr 20, 2024
@jayvdb jayvdb merged commit 317fb36 into Electron100:master Apr 20, 2024
4 checks passed
@jayvdb jayvdb deleted the migrate-rollback-helper branch April 20, 2024 18:23
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.

2 participants