Add the possibility to skip migrations#3846
Add the possibility to skip migrations#3846Dosenpfand wants to merge 1 commit intolaunchbadge:mainfrom
Conversation
b06c41e to
511b44b
Compare
abonander
left a comment
There was a problem hiding this comment.
Sorry for the delay in review. I'm happy to land this change as it's an oft-requested feature, but it needs rebasing and there's a couple design nits. Depending on when you get to this, there may not be time to land it in 0.9.0.
However, if we modify it to not be a breaking change (which is quite easy), then this can land in any future release.
sqlx-cli/src/lib.rs
Outdated
| ) | ||
| .await? | ||
| } | ||
| MigrateCommand::Skip { |
There was a problem hiding this comment.
I'd like to put this under an override subcommand. That way, it's clear that what you're doing is potentially dangerous, and we can add other useful commands there as well (such as forgetting already-run migrations or updating their hashes).
There was a problem hiding this comment.
I adapted it, hope I understood you correctly.
sqlx-core/src/migrate/migrate.rs
Outdated
| fn apply<'e: 'm, 'm>( | ||
| &'e mut self, | ||
| migration: &'m Migration, | ||
| skip: bool, |
There was a problem hiding this comment.
Instead of modifying the signature of this method, which is a breaking change, we can add a new method with a provided body that returns Err(MigrateError::SkipNotSupported) by default.
f135644 to
c92227b
Compare
|
Sorry for the delay also from my side and thank you for the feedback! I tried to address your findings. |
387c35f to
0ffb6a9
Compare
0ffb6a9 to
856519c
Compare
Does your PR solve an issue?
fixes #3841
Is this a breaking change?
Yes, it modifies the public trait
Migrate.