Closed jayvdb closed 2 months ago
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.
These helpers could be placed on
Migrations
or onBackendConnection
, 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 anErr
, but I am happy to do that - probably by creating a newError
enum for this.