Skip to content

Commit

Permalink
Add check constraint on pic_id vid_id
Browse files Browse the repository at this point in the history
  • Loading branch information
blissd committed Apr 11, 2024
1 parent 22a564a commit b3f6cbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ impl Repository {
video_id TEXT UNIQUE ON CONFLICT IGNORE, -- path to preview
stem_path TEXT UNIQUE NOT NULL ON CONFLICT IGNORE, -- visual artefact path minus suffix
FOREIGN KEY (picture_id) REFERENCES pictures (picture_id) ON DELETE CASCADE,
FOREIGN KEY (video_id) REFERENCES videos (video_id) ON DELETE CASCADE
FOREIGN KEY (video_id) REFERENCES videos (video_id) ON DELETE CASCADE,
CONSTRAINT one_of_picture_or_video CHECK ((picture_id IS NOT NULL) OR (video_id IS NOT NULL))
)",
];

Expand Down

0 comments on commit b3f6cbf

Please sign in to comment.