Is your feature request related to a problem? Please describe.
At the start of a project, stability isn't usually important so developers take the expedient path. Later, as the project gains adoption, stability, things like being able to rollback changes become important.
This applies to me and my usage of sqlx migrations. Initially, I used non-reversible migrations. After all, I could just blast my DB and star over, so why write reversible ones. Now, things are more serious and I'd like to use reversible migrations, but I can't. The sqlx CLI prevents me from applying a reversible migration once I have non-reversible ones - the -r flag is ignored. My understanding is that this is intentional - https://github.com/launchbadge/sqlx/pull/2664
Describe the solution you'd like
Running sqlx migrate -r something should create a reversible migration even if prior migrations are not. sqlx migrate revert should do the right thing and prevent me from trying to revert a non-reversible migration. I'm ok if all migrations going forward are automatically inferred to be reversible.
Manually combining all of my existing migrations and starting from scratch. But I'm not sure how to do that while maintaining an existing database, short of hacking the _migration table myself.
Is your feature request related to a problem? Please describe.
At the start of a project, stability isn't usually important so developers take the expedient path. Later, as the project gains adoption, stability, things like being able to rollback changes become important.
This applies to me and my usage of sqlx migrations. Initially, I used non-reversible migrations. After all, I could just blast my DB and star over, so why write reversible ones. Now, things are more serious and I'd like to use reversible migrations, but I can't. The sqlx CLI prevents me from applying a reversible migration once I have non-reversible ones - the
-r
flag is ignored. My understanding is that this is intentional - https://github.com/launchbadge/sqlx/pull/2664Describe the solution you'd like
Running
sqlx migrate -r something
should create a reversible migration even if prior migrations are not. sqlx migrate revert should do the right thing and prevent me from trying to revert a non-reversible migration. I'm ok if all migrations going forward are automatically inferred to be reversible.At the very least, it'd be nice to see a warning or even fail a command rather than ignore the -r flag: https://github.com/launchbadge/sqlx/pull/2664
Describe alternatives you've considered
Manually combining all of my existing migrations and starting from scratch. But I'm not sure how to do that while maintaining an existing database, short of hacking the _migration table myself.