Compare commits

...

1 commit

Author SHA1 Message Date
Ryan Dahl
9b1ac993ee [miniflare] Use workerd's built-in D1 for local D1 databases
Local D1 bindings now go to workerd's D1 Worker, the bundled module
/workerd/d1.js, with {"database": "<id>"} in their props. Its Durable
Objects keep Miniflare's uniqueKey (miniflare-D1DatabaseObject) and
disk, so existing local databases are the same files; a database
written by the previous Miniflare reads back unchanged.

Miniflare's own D1 object (database.worker.ts) and its helpers are
removed. The entry worker, used by the local explorer and shared
storage to reach a database named at runtime, now forwards to workerd's
D1 through the debug port, as the KV entry worker does.

Tests: served_by is "workerd"; query() errors are named Error, not
D1_ERROR. Removed are three regression tests for failures writing the
session bookmark, which no longer writes. PRAGMA miniflare_d1_export,
for wrangler d1 export --local, is answered by workerd's D1, and the
export tests pass against it.

Needs a workerd release with workerd#8486, and generated/workerd.ts
regenerated from it so the config can carry Worker.Module.bundled;
until then the D1 tests fail.
2026-11-16 08:08:53 -08:00
12 changed files with 126 additions and 961 deletions