You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We would like to be able to specify the schema version of our database in source control, and execute downgrades/upgrades in a source-driven way. To accomplish this, we need to be able to have direct control over the schema version of the database.
We have multiple environments that might need to be on different schema versions, while our source of truth for migrations may be several versions ahead. Thus, we want to keep versioning in source control.
Describe the solution you'd like
We would like a CLI flag for run and revert called --target <VERSION> which takes the schema version that the database should be taken to.
If run, it will apply only the migrations that get the DB to that version,. If revert, it will apply the correct down migrations to take the DB to that version.
We would also accept a subcommand of sqlx migrate called target, i.e. sqlx migrate target <VERSION> which does whatever is necessary to take the DB to that version.
Describe alternatives you've considered
We could have our automation change the migrations that are available to sqlx, i.e. delete any migrations at runtime that are unnecessary. This is rather hacky, and introduces a lot of error-prone shell glue into our automation.
We can write some Rust glue around the sqlx API to accomplish the same thing, but it seemed wiser to try and get the feature upstream instead.
Additional context
I'm more than happy to contribute the work needed, just inquiring first to gauge the maintainers' interest in such a feature and any thoughts on design.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We would like to be able to specify the schema version of our database in source control, and execute downgrades/upgrades in a source-driven way. To accomplish this, we need to be able to have direct control over the schema version of the database.
We have multiple environments that might need to be on different schema versions, while our source of truth for migrations may be several versions ahead. Thus, we want to keep versioning in source control.
Describe the solution you'd like
We would like a CLI flag for
run
andrevert
called--target <VERSION>
which takes the schema version that the database should be taken to.If
run
, it will apply only the migrations that get the DB to that version,. Ifrevert
, it will apply the correct down migrations to take the DB to that version.We would also accept a subcommand of
sqlx migrate
calledtarget
, i.e.sqlx migrate target <VERSION>
which does whatever is necessary to take the DB to that version.Describe alternatives you've considered
We could have our automation change the migrations that are available to sqlx, i.e. delete any migrations at runtime that are unnecessary. This is rather hacky, and introduces a lot of error-prone shell glue into our automation.
Refinery does support {up,down}grading to a target version, but we are already invested deeply into the
sqlx
ecosystem.We can write some Rust glue around the sqlx API to accomplish the same thing, but it seemed wiser to try and get the feature upstream instead.
Additional context
I'm more than happy to contribute the work needed, just inquiring first to gauge the maintainers' interest in such a feature and any thoughts on design.
The text was updated successfully, but these errors were encountered: