Conversation
…/projectCount Databases created with v0.1.x were missing the three new fields added in v0.2.0 (lastRecalled, recallCount, projectCount). On the first query after upgrading, LanceDB threw: Schema error: No field named 'lastRecalled'. Valid fields are scope, importance, timestamp, schemaVersion, vectorDim, id, text, vector, category, embeddingModel, metadataJson. Root cause: ensureMemoriesTableCompatibility() was never implemented, while the equivalent ensureEventTableCompatibility() already existed for the effectiveness_events table. Fix: - Add ensureMemoriesTableCompatibility() using the same addColumns() pattern - Call it from init() after table open, before ensureIndexes() - Add seedLegacyMemoriesTable() test helper in test/setup.ts - Add foundation test 'store init patches legacy memories schema...' that seeds a v0.1.x-style table and verifies the three columns are readable with value 0 after migration Bump version to 0.2.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After upgrading from v0.1.x to v0.2.0, any existing database fails immediately with:
Root Cause
v0.2.0 added three new fields to every memory record (
lastRecalled,recallCount,projectCount) and updatedreadByScopes()to SELECT them. However, unlike theeffectiveness_eventstable which already hadensureEventTableCompatibility()to patch missing columns on init, there was no equivalent for thememoriestable. Existing v0.1.x databases simply don't have those columns.Fix
ensureMemoriesTableCompatibility()using the sameaddColumns()pattern asensureEventTableCompatibility()init()after the memories table is opened, beforeensureIndexes()CAST(0 AS BIGINT/INT)as their SQL default, so all legacy records read back with value0seedLegacyMemoriesTable()test helper and a new foundation test that seeds a v0.1.x-style DB (no usage tracking columns) and verifies the three fields are readable after migrationVerification
npm run verify: foundation 11/11, regression 18/18, retrieval 2/2