lancedb-opencode-pro 0.2.0 → 0.2.1
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/store.d.ts +1 -0
- package/dist/store.js +27 -0
- package/package.json +1 -1
package/dist/store.d.ts
CHANGED
package/dist/store.js
CHANGED
|
@@ -73,6 +73,7 @@ export class MemoryStore {
|
|
|
73
73
|
this.eventTable = await this.connection.createTable(EVENTS_TABLE_NAME, [bootstrapEvent]);
|
|
74
74
|
await this.eventTable.delete("id = '__bootstrap__'");
|
|
75
75
|
}
|
|
76
|
+
await this.ensureMemoriesTableCompatibility();
|
|
76
77
|
await this.ensureEventTableCompatibility();
|
|
77
78
|
await this.ensureIndexes();
|
|
78
79
|
}
|
|
@@ -519,6 +520,32 @@ export class MemoryStore {
|
|
|
519
520
|
this.indexState.ftsError = error instanceof Error ? error.message : String(error);
|
|
520
521
|
}
|
|
521
522
|
}
|
|
523
|
+
async ensureMemoriesTableCompatibility() {
|
|
524
|
+
const table = this.requireTable();
|
|
525
|
+
const schema = await table.schema();
|
|
526
|
+
const fieldNames = new Set(schema.fields.map((field) => field.name));
|
|
527
|
+
const missing = [];
|
|
528
|
+
if (!fieldNames.has("lastRecalled")) {
|
|
529
|
+
missing.push({ name: "lastRecalled", valueSql: "CAST(0 AS BIGINT)" });
|
|
530
|
+
}
|
|
531
|
+
if (!fieldNames.has("recallCount")) {
|
|
532
|
+
missing.push({ name: "recallCount", valueSql: "CAST(0 AS INT)" });
|
|
533
|
+
}
|
|
534
|
+
if (!fieldNames.has("projectCount")) {
|
|
535
|
+
missing.push({ name: "projectCount", valueSql: "CAST(0 AS INT)" });
|
|
536
|
+
}
|
|
537
|
+
if (missing.length === 0) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
try {
|
|
541
|
+
await table.addColumns(missing);
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
545
|
+
const names = missing.map((col) => col.name).join(", ");
|
|
546
|
+
throw new Error(`Failed to patch ${TABLE_NAME} schema for columns [${names}]: ${reason}`);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
522
549
|
async ensureEventTableCompatibility() {
|
|
523
550
|
const table = this.requireEventTable();
|
|
524
551
|
const schema = await table.schema();
|