mindpm 1.2.19 → 1.2.20
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.
- package/dist/index.js +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -134,8 +134,6 @@ function createSchema(db2) {
|
|
|
134
134
|
CREATE INDEX IF NOT EXISTS idx_sessions_project_id ON sessions(project_id);
|
|
135
135
|
CREATE INDEX IF NOT EXISTS idx_sessions_created_at ON sessions(created_at);
|
|
136
136
|
|
|
137
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_seq ON tasks(project_id, seq);
|
|
138
|
-
|
|
139
137
|
CREATE INDEX IF NOT EXISTS idx_context_project_id ON context(project_id);
|
|
140
138
|
|
|
141
139
|
-- Triggers for updated_at (WHEN clause prevents infinite recursion)
|
|
@@ -194,6 +192,9 @@ function runMigrations(db2) {
|
|
|
194
192
|
});
|
|
195
193
|
}
|
|
196
194
|
}
|
|
195
|
+
if (!db2.prepare("SELECT name FROM sqlite_master WHERE type='index' AND name='idx_tasks_seq'").get()) {
|
|
196
|
+
db2.exec("CREATE INDEX idx_tasks_seq ON tasks(project_id, seq)");
|
|
197
|
+
}
|
|
197
198
|
const decisionCols = db2.pragma("table_info(decisions)").map((c) => c.name);
|
|
198
199
|
if (!decisionCols.includes("task_id")) {
|
|
199
200
|
db2.exec("ALTER TABLE decisions ADD COLUMN task_id TEXT REFERENCES tasks(id)");
|
|
@@ -992,9 +993,11 @@ var deleteTask = async (_req, res, params) => {
|
|
|
992
993
|
const deleteTransaction = db2.transaction((taskId) => {
|
|
993
994
|
const subtasks = db2.prepare("SELECT id FROM tasks WHERE parent_task_id = ?").all(taskId);
|
|
994
995
|
for (const sub of subtasks) {
|
|
996
|
+
db2.prepare("DELETE FROM task_history WHERE task_id = ?").run(sub.id);
|
|
995
997
|
db2.prepare("DELETE FROM notes WHERE task_id = ?").run(sub.id);
|
|
996
998
|
db2.prepare("DELETE FROM tasks WHERE id = ?").run(sub.id);
|
|
997
999
|
}
|
|
1000
|
+
db2.prepare("DELETE FROM task_history WHERE task_id = ?").run(taskId);
|
|
998
1001
|
db2.prepare("DELETE FROM notes WHERE task_id = ?").run(taskId);
|
|
999
1002
|
db2.prepare("DELETE FROM tasks WHERE id = ?").run(taskId);
|
|
1000
1003
|
});
|