Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return &mut Self from the migrator set_ methods #3526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nipunn1313
Copy link

@nipunn1313 nipunn1313 commented Sep 26, 2024

This allows the migrator methods to be chained.

Fixes #1788

@abonander abonander added this to the 0.9.0 milestone Oct 2, 2024
@abonander
Copy link
Collaborator

@nipunn1313 sorry about how long it took me to look at this, but this won't make this example work because you need something that takes self and returns Self (i.e. not a reference) to result with an owned Migrator.

It would have to be something like

pub const fn with_ignore_missing(self, value: bool) -> Self

I labeled this as breaking because while it seems innocuous enough--in most cases &mut Migrator will coerce to &Migrator just fine--I can conceive of a situation where this would break code that compiled before: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=2b874b42707b732a3cd20690a64d5290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing --ignore-missing to sqlx::migrate! macro
2 participants