snapshot_files FK on file_id lacks ON DELETE CASCADE #19

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

In schema.sql:

CREATE TABLE IF NOT EXISTS snapshot_files (
    ...
    FOREIGN KEY (file_id) REFERENCES files(id)
);

The FK from snapshot_files.file_id to files.id does NOT cascade. If orphaned files are deleted during cleanup, this will fail. The snapshot_id FK does cascade (from snapshots), but the file_id side does not.

Similarly, snapshot_blobs.blob_id references blobs(id) without CASCADE.

Ref: parent issue #1

In `schema.sql`: ```sql CREATE TABLE IF NOT EXISTS snapshot_files ( ... FOREIGN KEY (file_id) REFERENCES files(id) ); ``` The FK from `snapshot_files.file_id` to `files.id` does NOT cascade. If orphaned files are deleted during cleanup, this will fail. The `snapshot_id` FK does cascade (from snapshots), but the `file_id` side does not. Similarly, `snapshot_blobs.blob_id` references `blobs(id)` without CASCADE. 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#19
No description provided.