open-think 0.3.4 → 0.4.0
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.
|
@@ -142,6 +142,44 @@ var migrations = [
|
|
|
142
142
|
up: (db) => {
|
|
143
143
|
db.exec("ALTER TABLE memories ADD COLUMN decisions TEXT;");
|
|
144
144
|
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
version: 6,
|
|
148
|
+
up: (db) => {
|
|
149
|
+
db.exec(`
|
|
150
|
+
CREATE TABLE IF NOT EXISTS long_term_events (
|
|
151
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
152
|
+
ts TEXT NOT NULL,
|
|
153
|
+
author TEXT NOT NULL,
|
|
154
|
+
kind TEXT NOT NULL,
|
|
155
|
+
title TEXT NOT NULL,
|
|
156
|
+
content TEXT NOT NULL,
|
|
157
|
+
topics TEXT NOT NULL DEFAULT '[]',
|
|
158
|
+
supersedes TEXT,
|
|
159
|
+
source_memory_ids TEXT NOT NULL DEFAULT '[]',
|
|
160
|
+
created_at TEXT NOT NULL,
|
|
161
|
+
deleted_at TEXT,
|
|
162
|
+
sync_version INTEGER NOT NULL DEFAULT 0
|
|
163
|
+
) STRICT;
|
|
164
|
+
`);
|
|
165
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_lte_ts ON long_term_events(ts);");
|
|
166
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_lte_sync_version ON long_term_events(sync_version);");
|
|
167
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_lte_supersedes ON long_term_events(supersedes);");
|
|
168
|
+
db.exec(`
|
|
169
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS long_term_events_fts
|
|
170
|
+
USING fts5(title, content, content='long_term_events', content_rowid='rowid');
|
|
171
|
+
`);
|
|
172
|
+
db.exec(`
|
|
173
|
+
CREATE TRIGGER IF NOT EXISTS long_term_events_ai AFTER INSERT ON long_term_events BEGIN
|
|
174
|
+
INSERT INTO long_term_events_fts(rowid, title, content) VALUES (new.rowid, new.title, new.content);
|
|
175
|
+
END;
|
|
176
|
+
`);
|
|
177
|
+
db.exec(`
|
|
178
|
+
CREATE TRIGGER IF NOT EXISTS long_term_events_ad AFTER DELETE ON long_term_events BEGIN
|
|
179
|
+
INSERT INTO long_term_events_fts(long_term_events_fts, rowid, title, content) VALUES ('delete', old.rowid, old.title, old.content);
|
|
180
|
+
END;
|
|
181
|
+
`);
|
|
182
|
+
}
|
|
145
183
|
}
|
|
146
184
|
];
|
|
147
185
|
function getCortexDb(cortexName) {
|