syncWithRemote deletes snapshot records without cleaning up related tables #10

Open
opened 2026-02-08 17:16:24 +01:00 by clawbot · 0 comments
Collaborator

In snapshot.go syncWithRemote(), local snapshots not found in remote are deleted with just:

if err := v.Repositories.Snapshots.Delete(v.ctx, snapshotIDStr); err != nil {

This only deletes the snapshots row. The snapshot_files, snapshot_blobs, and uploads rows are NOT deleted first. Depending on FK constraints, this may either fail (FK violation) or leave orphaned records.

Compare with ListSnapshots() which correctly deletes related records first, and deleteSnapshotFromLocalDB() which also handles this.

Ref: parent issue #1

In `snapshot.go` `syncWithRemote()`, local snapshots not found in remote are deleted with just: ```go if err := v.Repositories.Snapshots.Delete(v.ctx, snapshotIDStr); err != nil { ``` This only deletes the `snapshots` row. The `snapshot_files`, `snapshot_blobs`, and `uploads` rows are NOT deleted first. Depending on FK constraints, this may either fail (FK violation) or leave orphaned records. Compare with `ListSnapshots()` which correctly deletes related records first, and `deleteSnapshotFromLocalDB()` which also handles this. Ref: parent issue #1
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/vaultik#10
No description provided.