drivethrough-cli 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.mjs +18 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -1072,7 +1072,24 @@ var init_universal = __esm({
|
|
|
1072
1072
|
created_at TEXT
|
|
1073
1073
|
)`,
|
|
1074
1074
|
`CREATE INDEX IF NOT EXISTS idx_type ON data(type)`,
|
|
1075
|
-
|
|
1075
|
+
// idx_parent is PARTIAL. D1 bills a written row per index touched, so a full
|
|
1076
|
+
// index on parent_id charged every insert for an entry the common case never
|
|
1077
|
+
// reads: most rows are top-level (a form submission with no parent), and
|
|
1078
|
+
// `WHERE parent_id = ?` can only match a non-null value. Excluding NULLs
|
|
1079
|
+
// keeps every query that used it — `type = ?1 AND parent_id = ?2` — on an
|
|
1080
|
+
// index, while top-level inserts stop paying for it.
|
|
1081
|
+
//
|
|
1082
|
+
// The one reader of NULL parents (selectSessionRow's `parent_id IS NULL`
|
|
1083
|
+
// branch) cannot use a partial index, and did not want this one anyway: it
|
|
1084
|
+
// filters on type first, and for the unique_per types it actually runs on,
|
|
1085
|
+
// uniq_session_<type> covers it.
|
|
1086
|
+
//
|
|
1087
|
+
// DROP first, under the old name: databases created before this change
|
|
1088
|
+
// already hold the full index, and `CREATE ... IF NOT EXISTS` would see it
|
|
1089
|
+
// and silently keep it. Renaming makes both statements true no-ops once the
|
|
1090
|
+
// upgrade has happened, so init() stays cheap to re-run.
|
|
1091
|
+
`DROP INDEX IF EXISTS idx_parent`,
|
|
1092
|
+
`CREATE INDEX IF NOT EXISTS idx_parent_present ON data(parent_id) WHERE parent_id IS NOT NULL`
|
|
1076
1093
|
];
|
|
1077
1094
|
UNIVERSAL_SCHEMA_SQL = UNIVERSAL_SCHEMA_STATEMENTS.join(";\n") + ";";
|
|
1078
1095
|
}
|