From 332ea26bce8c444be0a83a741d11ee10213af4f9 Mon Sep 17 00:00:00 2001 From: clawbot Date: Tue, 17 Mar 2026 13:42:23 -0700 Subject: [PATCH] fix: use deleteSnapshotFromLocalDB in syncWithRemote syncWithRemote was calling v.Repositories.Snapshots.Delete() directly, which only removes the snapshots row. This leaves orphaned rows in snapshot_files, snapshot_blobs, and uploads tables. Replace with deleteSnapshotFromLocalDB() which properly cleans up all related tables before deleting the snapshot record. closes #10 --- internal/vaultik/snapshot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/vaultik/snapshot.go b/internal/vaultik/snapshot.go index e0d93b2..2165c95 100644 --- a/internal/vaultik/snapshot.go +++ b/internal/vaultik/snapshot.go @@ -802,7 +802,7 @@ func (v *Vaultik) syncWithRemote() error { snapshotIDStr := snapshot.ID.String() if !remoteSnapshots[snapshotIDStr] { log.Info("Removing local snapshot not found in remote", "snapshot_id", snapshot.ID) - if err := v.Repositories.Snapshots.Delete(v.ctx, snapshotIDStr); err != nil { + if err := v.deleteSnapshotFromLocalDB(snapshotIDStr); err != nil { log.Error("Failed to delete local snapshot", "snapshot_id", snapshot.ID, "error", err) } else { removedCount++