From 699318380621510fb295acd57ecd5e9de17c0ca4 Mon Sep 17 00:00:00 2001 From: mirak29 Date: Wed, 29 Apr 2026 08:51:23 +0000 Subject: [PATCH 1/2] feat(db): auto-index entryId on generated field tables --- db/entries.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/entries.ts b/db/entries.ts index b483b55..ec010d5 100644 --- a/db/entries.ts +++ b/db/entries.ts @@ -257,6 +257,14 @@ export const initEntries = < [name]: { type }, }) + // SQLite only auto-indexes primary keys. fieldId is the PK, so entryId + // needs an explicit index — without it any partial index on entryInternal + // triggers a full table scan of the field table on every join. + sql` + CREATE INDEX IF NOT EXISTS idx_${tableName}_entry_id + ON ${tableName}(entryId) + `.run() + fieldTables[name] = table fields[name] = table } From 041b0118dd19cc264332a581ac7cb3b5d111fba8 Mon Sep 17 00:00:00 2001 From: mirak29 Date: Mon, 4 May 2026 04:52:47 +0200 Subject: [PATCH 2/2] chore(deno.json): Bump dbversion --- db/deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/deno.json b/db/deno.json index e6911ea..331295c 100644 --- a/db/deno.json +++ b/db/deno.json @@ -4,7 +4,7 @@ "@std/assert": "jsr:@std/assert@^1.0.19" }, "name": "@01edu/db", - "version": "0.2.3", + "version": "0.2.4", "license": "MIT", "exports": { ".": "./mod.ts",