Skip to content

fix(features): make migration support fully opt-in - #4420

Open
leseb wants to merge 1 commit into
transact-rs:mainfrom
leseb:leseb/implement-issue-4418
Open

leseb wants to merge 1 commit into
transact-rs:mainfrom
leseb:leseb/implement-issue-4418

Conversation

@leseb

@leseb leseb commented Sep 23, 2026

Copy link
Copy Markdown

Summary

Remove unconditional migration features from the facade and macro-support dependencies.

Migration support is now forwarded to sqlx-core and enabled database drivers only when the public migrate feature is selected. This preserves existing migration and CLI behavior while allowing no-default-features consumers to omit migration checksum dependencies.

Does your PR solve an issue?

Closes #4418

Is this a breaking change?

No intended public API break.

Users explicitly enabling migrate, as well as users relying on SQLx鈥檚 default features, retain the existing behavior. Downstream builds relying on accidental transitive activation of migration support will need to enable migrate explicitly.

Testing

Validated that:

  • Runtime-only builds exclude sqlx-core/migrate, sha2, and crc.
  • Macro builds with PostgreSQL, MySQL, or SQLite do not activate migration support unless requested.
  • Enabling migrate activates migration support for sqlx-core and every enabled driver.
  • Existing migration, macro, facade, and CLI configurations continue to compile.

Commands run include:

  • cargo fmt --all -- --check
  • cargo test -p sqlx-core --all-features
  • cargo test -p sqlx-macros-core --all-features
  • cargo test -p sqlx --lib --all-features
  • cargo check -p sqlx-cli --all-features
  • cargo clippy -p sqlx --no-default-features --features all-databases,macros -- -D warnings

No conventional Rust regression test was added because the regression concerns Cargo鈥檚 resolved feature and dependency graph, which cannot be inspected from a unit test after compilation. The negative and positive feature combinations were instead verified directly with cargo tree and cargo check.

Remove unconditional migration features from the facade and macro support
dependencies. Instead, forward migration support to sqlx-core and enabled
database drivers only when the public migrate feature is selected.

This preserves existing migrate and CLI behavior while allowing
no-default-features consumers to omit migration checksum dependencies.

Closes: transact-rs#4418
Signed-off-by: S茅bastien Han <seb@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make SQLx migration/checksum support fully opt-in

1 participant