[FR] Order migrations by sprinkle
avsdev-cw opened this issue · comments
When we spin up a new instance of UF with some of our stock sprinkles, the migration order is fairly random (whilst being somewhat alphabetically ordered).
It would be a lot more useful if the migration order was more predictable, e.g:
- Order by sprinkle
- Order by dependency
- Order alphabetically
This would be particularly helpful if we needed to roll-back a sprinkle as at the moment the sessions and throttles tables are nearly always the last to migrate. To get around it, we add the sprinkles in one by one and migrate between each step, which gets laborious for 5+ sprinkles.
P.S. I know there is an option to rollback a migration by specifying the name, but perhaps an option to rollback all migrations from a particular sprinkle would be a better feature request?
This is kind of already implement in V5 (check out the beta, wink wink). Migrations are loaded by the Sprinkle order, then by the order defined in each Sprinkle Recipe class.
But in any case (and in V4), dependent sprinkle will always be loaded first.
I don't think it's explicitly tested that way, but with the new SprinkleMigrationLocator
it should be easy to add if required.
Closing, as it shouldn't be an issue with UF5, if dependency are correctly applied in the migration definition.