Skip to content

feat!: upgrade sqlx to 0.9 and raise MSRV to 1.94.0 - #124

Merged
CodingAnarchy merged 1 commit into
masterfrom
feat/85-sqlx-0.9
Oct 11, 2026
Merged

CodingAnarchy merged 1 commit into
masterfrom
feat/85-sqlx-0.9

Conversation

@CodingAnarchy

Copy link
Copy Markdown
Owner

Closes #85
Part of #122

What

Moves the whole workspace (library, cargo-hammerwork, hammerwork-web, integrations/*) from sqlx 0.8 to 0.9 and raises the MSRV to Rust 1.94.0, which sqlx 0.9 requires.

sqlx is in Hammerwork's public API (the pool passed to JobQueue::new, JobQueue<DB: sqlx::Database>, DatabaseQueue, the migration runners, sqlx Encode/Decode on JobStatus/BatchStatus), so users have to move to sqlx 0.9 together with Hammerwork 3.0. Hammerwork's own signatures don't change.

Changes

  • Dependencies: workspace sqlx = "0.9" with runtime-tokio + tls-rustls-ring-webpki (sqlx 0.9 removed the combined runtime-tokio-rustls feature; this is the same rustls/ring/webpki stack). Default sqlx features (any, macros, migrate, json) are kept as before.
  • Dynamic SQL: sqlx 0.9's query*/raw_sql/Executor::execute only accept &'static str unless the string is wrapped in sqlx::AssertSqlSafe. Every runtime-built query is now wrapped, preferring owned Strings, which sqlx stores without copying. All of these were already parameterised; the wrapper just marks them as reviewed.
  • Migrations: the protocols stay the same. MySQL still runs each statement over the text protocol (tx.execute(AssertSqlSafe(stmt)), no arguments, so there's no prepare step), and PostgreSQL still uses sqlx::query.
  • IntoArguments: the lifetime parameter was dropped. This affected one test-only bound in key_manager.rs.
  • MySQL RSA auth: sqlx 0.9 moved RSA password encryption for non-TLS connections behind mysql-rsa. cargo-hammerwork and hammerwork-web enable it so the binaries connect as before. The library doesn't enable it; users opt in through their own sqlx dependency (documented). The rsa audit ignore in .cargo/audit.toml stays, with an updated comment.
  • MSRV: rust-version = "1.94.0", and the CI MSRV job uses 1.94.0.
  • Docs: ### Breaking changes under [Unreleased] in CHANGELOG, a new docs/upgrading-to-3.0.md (doctested via doc_examples; later 3.0 PRs append sections to it), a README link, a sqlx dependency line in the quick start, and CLAUDE.md notes.

Things I checked

  • MySQL TIMESTAMP(6) and PostgreSQL TIMESTAMPTZ decoding: unchanged, and both suites pass. sqlx still sets the MySQL session time_zone to +00:00.
  • MySQL collation: sqlx 0.9 sends SET NAMES utf8mb4 with no COLLATE clause, so connections get the server default (utf8mb4_0900_ai_ci on 8.0) instead of utf8mb4_unicode_ci. Freshly migrated tables use utf8mb4_0900_ai_ci, and Hammerwork compares columns with parameters, so behaviour doesn't change. This is noted in the upgrade guide.
  • Non-TLS MySQL login without mysql-rsa: I confirmed it fails with "RSA auth backend disabled" for a fresh caching_sha2_password user. This is why the binaries enable the feature.
  • Cargo.lock: only sqlx and its dependencies changed. The lockfile now has fewer duplicate crate versions than before; the one new duplicate is sha1 0.10/0.11. cargo deny check advisories is clean.

Testing

  • cargo fmt --all --check
  • cargo clippy --workspace --all-features --all-targets -- -D warnings
  • cargo clippy --no-default-features -- -D warnings
  • cargo clippy --features mysql -- -D warnings
  • cargo check --examples --all-features
  • cargo +1.94.0 check --workspace --all-features --all-targets --locked
  • cargo metadata --locked
  • PostgreSQL suite (--include-ignored --skip mysql): 2102 passed, 0 failed
  • MySQL suite (--include-ignored mysql): 232 passed, 0 failed
  • From-scratch migrations with the CLI on new hammerwork_sqlx09 databases (PostgreSQL, and MySQL with ssl-mode=disabled), then a second run to check idempotency. The scratch databases were dropped afterwards.

🤖 Generated with Claude Code

sqlx is part of Hammerwork's public API (pools, JobQueue<DB>,
DatabaseQueue, migration runners), so applications must move to sqlx 0.9
together with Hammerwork 3.0.

- Workspace sqlx 0.9 with runtime-tokio + tls-rustls-ring-webpki (the
  combined runtime/TLS features were removed).
- Wrap every runtime-built SQL string in sqlx::AssertSqlSafe (library,
  CLI, dashboard, tests). Migrations keep their protocols: MySQL runs each
  statement over the text protocol, PostgreSQL through sqlx::query.
- CLI and dashboard enable sqlx's mysql-rsa so non-TLS MySQL logins with
  caching_sha2_password keep working; the library leaves it to users.
- rust-version and the CI MSRV job move to 1.94.0.
- CHANGELOG breaking-changes entry, docs/upgrading-to-3.0.md (doctested),
  README link, quick-start sqlx dependency line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CodingAnarchy
CodingAnarchy merged commit a494fd1 into master Oct 11, 2026
21 checks passed
@CodingAnarchy
CodingAnarchy deleted the feat/85-sqlx-0.9 branch October 11, 2026 20:05
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.

3.0: upgrade sqlx to 0.9

1 participant