sdkMigrations
constsdkMigrations:Readonly<{maxVersion:number;minVersion:number;sortedMigrations:Readonly<{steps:MigrationStep[];toVersion:number; }>[];validated:true; }>
Defined in: src/lib/db/schema.ts:455
Combined migrations for all SDK storage modules.
These migrations handle database schema upgrades from any previous version to the current version. The SDK manages all migration logic internally, so consumer apps don’t need to handle version arithmetic or migration merging.
Minimum supported version: v2 Migrations from v1 are not supported. Databases at v1 require a fresh install.
Migration history:
- v2 → v3: Added
was_stoppedcolumn to history table - v3 → v4: Added
modelPreferencestable for settings storage - v4 → v5: Added
errorcolumn to history table for error persistence - v5 → v6: Added
thought_processcolumn to history table for activity tracking - v6 → v7: Added
userPreferencestable for unified user settings storage - v7 → v8: BREAKING - Clear all data (embedding model change)
- v8 → v9: Added
thinkingcolumn to history table for reasoning/thinking content - v9 → v10: Added
projectstable andproject_idcolumn to conversations - v10 → v11: Added
mediatable for library feature, addedfile_idscolumn to history - v11 → v12: Added
chunkscolumn to history table for sub-message semantic search - v12 → v13: Added
parent_message_idcolumn to history table for message branching - v13 → v14: Added
feedbackcolumn to history table for like/dislike on responses - v14 → v15: Replaced
memoriestable withmemory_vaulttable for persistent memory vault - v15 → v16: Added
scopecolumn to memory_vault table for memory partitioning - v16 → v17: Added
image_modelcolumn to history table for AI-generated image model tracking - v17 → v18: Added
vault_folderstable (with scope) andfolder_idcolumn to memory_vault for folder organization - v18 → v19: Added
user_idcolumn to memory_vault for multi-user server-side scoping - v19 → v20: Added index on
updated_atcolumn of memory_vault for efficient since-based filtering - v20 → v21: Added
embeddingcolumn to memory_vault for persisted embedding vectors - v21 → v22: Added
is_systemcolumn to vault_folders for default system folders - v22 → v23: Added
conversation_summariestable for progressive history summarization - v23 → v24: Added
contextcolumn to vault_folders for LLM-generated folder summaries - v24 → v25: Added
saved_toolstable for user-saved display apps exposed as LLM tools - v25 → v26: Added
app_filestable for LLM-generated app source files (HTML/CSS/JS) - v26 → v27: Added
tool_call_eventscolumn to history for reconstructing tool call history - v27 → v28: Added
source_chunk_ids,proof_count,sourcecolumns to memory_vault for auto-extraction provenance and supersession tracking - v28 → v29: Added
entity+memory_entitytables for W5 knowledge-graph retrieval lane - v29 → v30: Added
event_time_start,event_time_end,event_time_kindcolumns to memory_vault for W6 temporal retrieval lane - v30 → v31: Added
user_idcolumn to memory_entity for multi-user scoping of the W5 graph lane (with backfill from memory_vault.user_id) - v31 → v32: Added
pinned_atcolumn to conversations for pinning chats - v32 → v33: Added
embedding_modelcolumn to memory_vault (null grandfathered as current-model-compatible) - v33 → v34: Added
topics_user_managedcolumn to memory_vault (null/false = auto-derived topics, the default) - v34 → v35: Added
conversation_memorytable (conversation ↔ recalled memory ids) - v35 → v36: Added
topics_extracted_atcolumn to memory_vault (watermark for the background topic-extraction worker; null + existing links grandfathered as extracted) - v36 → v37: Added
superseded_by+superseded_atcolumns to memory_vault (write-time supersession; null = live, excluded from recall/dedup when set) - v37 → v38: Added
topics_extracted_versioncolumn to memory_vault (extraction-logic version; null read as 0 so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows) - v38 → v39: Added
last_observed_atcolumn to memory_vault (C3 re-observation watermark; stamped on retain merge, distinct from updated_at) - v39 → v40: Added
fact_type,archived_at,trust_tiercolumns to memory_vault for typed memory + decay + Tier-0 security (all nullable + plaintext, NULL backfill) - v40 → v41: Added
visibility,twin_opt_in,published_at,geohashcolumns to memory_vault for the People Nearby cross-user visibility axis (two-tierprivate | public; null/unknown grandfathered as ‘private’) - v41 → v42: Added
topics+topics_updated_atcolumns to memory_vault, making a memory’s topics the durable synced record andentity/memory_entitya device-local index over it (nulltopics= pre-v42, backfilled from the row’s current links by the sweep) - v42 → v43: Added a composite
(is_deleted, created_at)index to conversations so the list reads stop temp-sorting (structural only, no data rewritten) - v43 → v44: Added
origincolumn to history recording which producer synthesised a row, so the embedding sweep can skip never-rendered tool-result dumps (plaintext by design — the sweep has no wallet context; null = legacy, embedded as before) - v47 → v48: Added
kind,kind_value,levelto memory_vault;levelbackfilled fromscope(shared/public→ matching, else private) where SQL steps run
Last updated on