Repository navigation
Accept journal_mode, synchronous, and busy_timeout in SQLite URLs - #401
Merged
Merged
Conversation
Laravel PHP's SQLite connections accept these options, including in DB_URL. SQLx rejects them on the URL, so DATABASE_URL couldn't enable WAL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Amp-Thread-ID: https://ampcode.com/threads/T-4b34fcd3-0d8f-4878-a303-28fa30e6d865 Co-authored-by: Taylor Otwell <taylor@laravel.com>
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.
Fixes #400.
Laravel PHP's SQLite connections accept
journal_mode,synchronous, andbusy_timeout(including inDB_URL), but SQLx rejects them on the URL, soDATABASE_URLcouldn't enable WAL.Sqlite::optionsnow takes these three out of the query string, passes the rest to SQLx's parser unchanged, and applies them throughSqliteConnectOptions. URLs without them are parsed exactly as before. Every SQLite source (pools, read/write endpoints, test databases,schema:dump) goes throughSqlite::options, so they all accept the new options. Options you leave out keep SQLite's defaults.busy_timeoutis in milliseconds, as in PHP.Tests:
sqlite_urls_accept_journal_mode_synchronous_and_busy_timeoutchecks that the pragmas are applied, thatmode=memory&cache=sharedsurvive, and that invalid values are reported. It fails without the change.Verified with
cargo test --features database-sqlite --test database(359 passed;schema_dump::schema_dump_writes_the_sqlite_schema_with_the_migrations_rowsfails the same way on0.xwith my local sqlite3 3.53.4), thelaravel-rust-databasedoctests,cargo clippy -p laravel-rust-database --all-targets --all-features -- -D warnings, andcargo fmt --all -- --check.A natural follow-up would be
journal_mode,synchronous, andbusy_timeoutsetters onConnectionConfig, matching the keys in PHP'sconfig/database.php, so they can be set insrc/config/database.rsas well. Happy to send that if you'd like it.🤖 Generated with Claude Code