uploads table FK on snapshot_id lacks ON DELETE CASCADE #18

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

In schema.sql, the uploads table has:

FOREIGN KEY (snapshot_id) REFERENCES snapshots(id)

Unlike snapshot_files and snapshot_blobs which have ON DELETE CASCADE, the uploads FK does not cascade. This means deleting a snapshot without first deleting its uploads will fail with a FK violation (if FK enforcement is on). The code works around this by manually deleting uploads first in deleteSnapshotFromLocalDB, but syncWithRemote does NOT do this cleanup.

Ref: parent issue #1

In `schema.sql`, the `uploads` table has: ```sql FOREIGN KEY (snapshot_id) REFERENCES snapshots(id) ``` Unlike `snapshot_files` and `snapshot_blobs` which have `ON DELETE CASCADE`, the `uploads` FK does not cascade. This means deleting a snapshot without first deleting its uploads will fail with a FK violation (if FK enforcement is on). The code works around this by manually deleting uploads first in `deleteSnapshotFromLocalDB`, but `syncWithRemote` does NOT do this cleanup. 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#18
No description provided.