@henryqw/pi-session-recall 0.2.2 → 0.2.3
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.
|
@@ -157,6 +157,14 @@ function openDb(dbPath: string): DatabaseSync {
|
|
|
157
157
|
// both sides case-fold through the same foldCase helper.
|
|
158
158
|
db.function("ulower", (s: SQLOutputValue): string => typeof s === "string" ? foldCase(s) : "");
|
|
159
159
|
db.function("unear", nearLike);
|
|
160
|
+
// Creating a missing external-content FTS table after messages and their
|
|
161
|
+
// watermarks persist leaves it blank: unchanged files never replay inserts.
|
|
162
|
+
// The disposable index must be deleted and rebuilt instead of repaired here.
|
|
163
|
+
const hasFts = db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'session_fts'").get() !== undefined;
|
|
164
|
+
const hasPersistedSchema = db.prepare("SELECT 1 FROM sqlite_master WHERE name NOT LIKE 'sqlite_%' LIMIT 1").get() !== undefined;
|
|
165
|
+
if (!hasFts && hasPersistedSchema) {
|
|
166
|
+
throw new Error("index schema incompatible: session_fts missing — delete the index to rebuild");
|
|
167
|
+
}
|
|
160
168
|
db.exec(SCHEMA_SQL);
|
|
161
169
|
// CREATE TABLE IF NOT EXISTS cannot repair a predecessor index whose
|
|
162
170
|
// tables exist but lack current watermark columns (e.g. no ctime_ms): its
|
package/package.json
CHANGED