feat(core): sqlite driver for durable object storage - #41659
Merged
Conversation
Contributor
Author
|
Implementation and verification are complete; ready for review. |
kitlangton
force-pushed
the
durable-object-sqlite
branch
from
August 11, 2026 19:30
4d57e54 to
97732ec
Compare
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.
What
SqlClientdriver over injected Cloudflare Durable Object storage.Database.layerFromClient, the database service layer over an injectedSqlClient— for runtimes that receive database storage instead of opening a filesystem path. TheSqlClientandGlobalrequirements stay visible in the layer type and the caller composes standardLayer.provide; any client provided still goes through the pragma guards and migrations.Why
Running the OpenCode server embedded in edge and Durable Object runtimes requires database access over injected storage rather than a filesystem path. The new seam is runtime-neutral, and the Durable Object driver remains inert unless a runtime explicitly composes it.
How
sqlite.workerd.tsadaptsstorage.sql.execto Effect SQL, normalizes blob results, and maps Durable Object transactions towithTransaction. Nested transactions fail withSqlErrorbecause Durable Object SQLite does not support savepoints.Database.layer()now composes overDatabase.layerFromClient, preserving its existingGlobal.Servicepath resolution.Testing
bunx tsgo --noEmitinpackages/corebun test test/sqlite-workerd.test.tsbun test test/sqlite-workerd.test.ts test/database-migration.test.tsbun run testinpackages/core(1,641 passed, 16 skipped)Severability
The co-tenancy policy is isolated in
fix(core): schema bootstrap ignores co-tenant tables. Reviewers can drop that commit without affecting the Durable Object driver orDatabase.layerFromClientseam.