[Feature]: Support multiple RDBMS for background jobs persistence #631
Open
Ismaellima4 wants to merge 8 commits into
Open
Conversation
Extract backend-specific SQL into dedicated structs (Postgres, Mysql,
Sqlite)
and dispatch via match on DbBackend instead of hardcoding PostgreSQL.
Migration:
- Remove gen_random_uuid(), DEFAULT now(), DEFAULT '{}' — application
supplies all values
- Conditional index: partial for Postgres, regular for MySQL, skip for
SQLite
Model:
- Manual FromQueryResult — try native Uuid first, then String + parse
(SQLite stores UUIDs as TEXT)
Backend extraction (backend.rs):
- build_insert_stmt, build_retry_stmt, build_fail_stmt,
build_success_stmt,
claim_batch per backend
- mod.rs / retry.rs / worker.rs dispatch via match on DbBackend
arferreira
requested changes
Jun 18, 2026
arferreira
left a comment
Collaborator
There was a problem hiding this comment.
Good work so far, thanks! I pulled your branch and ran the SQlite e2e locally, looking great. I left some comments important to address before we merge, it might be better if you run against a real MySQL 8.
- MySQL claim_select: SELECT {id} instead of SELECT *
(only the id column is needed)
- Add 9 backend-specific unit tests (SQL shape, params, value types)
- Remove trivial Uuid::new_v4() test
- Fix doc on accessors (explain &str vs to_string trade-off)
- Document json() vs json_binary() portability choice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What does this PR do?
Extract backend-specific SQL into dedicated structs (Postgres, Mysql, Sqlite)
and dispatch via match on DbBackend instead of hardcoding PostgreSQL.
Migration:
Model:
Backend extraction (backend.rs):
Related Issues
Closes #430
Checklist
cargo fmtpassescargo clippyhas no warnings