fix: clear instance history on delete and import
deleteInstance now removes history rows for that vmid before removing the instance. importInstances clears all history before replacing instances. Prevents stale history appearing when a vmid is reused. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -151,11 +151,13 @@ export function updateInstance(vmid, data) {
|
||||
}
|
||||
|
||||
export function deleteInstance(vmid) {
|
||||
return db.prepare('DELETE FROM instances WHERE vmid = ?').run(vmid);
|
||||
db.prepare('DELETE FROM instance_history WHERE vmid = ?').run(vmid);
|
||||
db.prepare('DELETE FROM instances WHERE vmid = ?').run(vmid);
|
||||
}
|
||||
|
||||
export function importInstances(rows) {
|
||||
db.exec('BEGIN');
|
||||
db.exec('DELETE FROM instance_history');
|
||||
db.exec('DELETE FROM instances');
|
||||
const insert = db.prepare(`
|
||||
INSERT INTO instances
|
||||
|
||||
Reference in New Issue
Block a user