feat: include history in export/import backup
Export now returns version 2 with a history array alongside instances. Import accepts the history array and restores all audit events. v1 backups without a history key still import cleanly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -202,6 +202,15 @@ describe('importInstances', () => {
|
||||
importInstances([{ ...base, name: 'new', vmid: 2 }]);
|
||||
expect(getInstanceHistory(1)).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('restores history rows when provided', () => {
|
||||
importInstances(
|
||||
[{ ...base, name: 'a', vmid: 1 }],
|
||||
[{ vmid: 1, field: 'created', old_value: null, new_value: null, changed_at: '2026-01-01 00:00:00' }]
|
||||
);
|
||||
const h = getInstanceHistory(1);
|
||||
expect(h.some(e => e.field === 'created')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
// ── instance history ─────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user