Skip to content

Commit 37796d5

Browse files
author
StackMemory Bot (CLI)
committed
chore: handoff checkpoint on main
1 parent 834595e commit 37796d5

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

src/core/context/frame-database.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ export class FrameDatabase {
151151
);
152152
`);
153153

154+
// Migration: add retention_policy column if missing (pre-v0.8 databases)
155+
try {
156+
this.db.exec(
157+
"ALTER TABLE frames ADD COLUMN retention_policy TEXT DEFAULT 'default'"
158+
);
159+
} catch {
160+
// Column already exists — safe to ignore
161+
}
162+
154163
// Create indexes for performance
155164
this.db.exec(`
156165
CREATE INDEX IF NOT EXISTS idx_frames_run ON frames(run_id);

src/core/database/sqlite-adapter.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,10 @@ export class SQLiteAdapter extends FeatureAwareDatabaseAdapter {
151151
ErrorCode.DB_CONNECTION_FAILED
152152
);
153153

154-
// Delegate base table creation to FrameDatabase (single canonical schema source)
154+
// Delegate base table creation + migrations to FrameDatabase (single canonical schema source)
155155
const frameDb = new FrameDatabase(this.db);
156156
frameDb.initSchema();
157157

158-
// Migration: add retention_policy column if not exists
159-
try {
160-
this.db.exec(
161-
"ALTER TABLE frames ADD COLUMN retention_policy TEXT DEFAULT 'default'"
162-
);
163-
logger.info('Added retention_policy column to frames');
164-
} catch {
165-
// Column already exists — safe to ignore
166-
}
167-
168-
// Index for GC queries on retention_policy + age (must be after ALTER TABLE migration)
169-
this.db.exec(
170-
'CREATE INDEX IF NOT EXISTS idx_frames_retention_created ON frames(retention_policy, created_at)'
171-
);
172-
173158
// Ensure cascade constraints exist on dependent tables for existing DBs
174159
try {
175160
this.ensureCascadeConstraints();

0 commit comments

Comments
 (0)