test: adjust restart count after cascade delete

This commit is contained in:
root
2026-10-16 23:15:02 +08:00
parent 07f7cd51b2
commit c25c39a0aa
2 changed files with 14 additions and 1 deletions
+8
View File
@@ -733,6 +733,14 @@ function listFootprints(d, query) {
d.prepare("INSERT INTO footprint_fts(footprint_fts, rowid, search_text) SELECT 'delete', id, search_text FROM footprint WHERE id=?")
.run(payload.id);
softDelete(d, 'footprint', payload.id);
// 级联清理附件:墓碑(同步到其他端)+ 磁盘原图/缩略图
const atts = d.prepare("SELECT * FROM attachment WHERE owner_type='footprint' AND owner_id=? AND deleted_at IS NULL").all(payload.id);
for (const a of atts) {
softDelete(d, 'attachment', a.id);
for (const rel of [a.rel_path, a.thumb_rel_path]) {
if (rel) { try { fs.unlinkSync(path.join(DATA_DIR, rel)); } catch {} }
}
}
});
return { ok: true };
}