test
This commit is contained in:
@@ -16,6 +16,14 @@ const migrations = [
|
||||
// used to run (wrapped in try/catch) on every boot are folded into schema.js.
|
||||
// Nothing to do here — this entry exists to mark v1 as the consolidated baseline.
|
||||
(_db) => {},
|
||||
|
||||
(db) => {
|
||||
db.exec(`
|
||||
ALTER TABLE episodes ADD COLUMN last_accessed_at INTEGER;
|
||||
ALTER TABLE episodes ADD COLUMN access_count INTEGER NOT NULL DEFAULT 0;
|
||||
`)
|
||||
db.exec(`UPDATE episdoes SET last_accessed_at = created_at WHERE last_accessed_at IS NULL`)
|
||||
}
|
||||
];
|
||||
|
||||
const LATEST_VERSION = migrations.length;
|
||||
|
||||
@@ -15,13 +15,15 @@ const schema = `
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS episodes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
session_id INTEGER NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
|
||||
user_message TEXT NOT NULL,
|
||||
ai_response TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
||||
token_count INTEGER,
|
||||
metadata TEXT
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
session_id INTEGER NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
|
||||
user_message TEXT NOT NULL,
|
||||
ai_response TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
||||
token_count INTEGER,
|
||||
metadata TEXT,
|
||||
last_accessed_at INTEGER,
|
||||
access_count INTEGER NOT NULL DEFAULT 0;
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS entities (
|
||||
|
||||
Reference in New Issue
Block a user