Add an option for sqlx migrate run to revert migrations if changed
I have found these related issues/pull requests
N/A
Description
Quite often one would re-run a migration being worked on adding a run -r would spare time.
Prefered solution
Add an option to revert and run again every migration that is detected to be changed till the older.
Is this a breaking change? Why or why not?
It is not, it is an additional opt-in feature.
I don't think this is a good idea, honestly.
If you want to revert every migration that's changed, that's assuming that you're actually using reversible migrations.
This also implies that the down-migration needs to not change; if it has changed, running it anyway could break things.
A lot of people already have a poor understanding of why migrations exist and why they're meant to be immutable. I don't want to invite a situation where someone messed up when running migrations or accidentally edited a migration that was already deployed, discovers this switch and thinks enabling it will just magically fix everything with no data loss.
If you're okay with the inherent data loss from reverting and re-running migrations, why not just use sqlx database reset?
If you're just tinkering with the database structure, maybe consider using a tool designed for interactive work (DataGrip, the database plugin in RustRover, dBeaver, pgAdmin, MySQL Workbench, etc) and then write the migrations afterward. If you're using RustRover with the database plugin, you can use it to run the migration files directly.
I'd be even happier to have a separate migrate dev command, not everybody uses the same IDE.