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
I don't know if we want it to be part of the baseline command or not but when developing a feature that modifies the database I realize I tend to do the following:
Write and run a migration for the schema changes I anticipate will be needed (new table, new columns in existing table, etc.)
Begin developing the feature
Realize I need to make more changes to the schema
Since the migration I just wrote hasn't been pushed to production, I prefer to modify it in-place and manually update the DB
But if the application uses sqlx::migrate!() it will die on startup because the migrations are out of sync with the database.
It's not that hard to just do openssl dgst -sha384 <migration file> and then update the hash in the _sqlx_migrations table but it would be nice to have a single command to do both.
I'm thinking we might want it to be separate from the baseline command because it's replacing the hash of a migration that's already run, but I'm not sure what I'd call it. sqlx migrate override?
# mark <version> as applied if not already (error on hash mismatch)
sqlx migrate override --just=<version>
# mark <version> as applied, overwrite hash
sqlx migrate override -f --just=version
# mark all migrations up to and including <version> as applied (error on hash mismatch)
sqlx migrate override --up-to=<version>
# mark all migrations up to and including <version> as applied, overwrite mismatched hashes
sqlx migrate override -f --up-to=<version>
# mark all migrations as applied (error on hash mismatch)
sqlx migrate override --all
# mark all migrations as applied, overwrite mismatched hashes
sqlx migrate override -f --all
# starts a dialogue asking the user to select the target migration version (defaulting to latest), all/upto/just that version, and attempt to process the selected versions, asking to quit/skip/force on each that mismatches
sqlx migrate override
See #639 (comment)
The text was updated successfully, but these errors were encountered: