From 9f6b0416b69457eba524f69de0cd2a46c942698b Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Mon, 14 Nov 2022 06:13:03 +1100 Subject: [PATCH] postgres: Don't allow state = MODIFIED without video_link set This is an illegal state but it happened :( --- postgres/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postgres/setup.sh b/postgres/setup.sh index 98483d4..0decea6 100644 --- a/postgres/setup.sh +++ b/postgres/setup.sh @@ -120,10 +120,10 @@ CREATE TABLE events ( uploader TEXT CHECK (state IN ('UNEDITED', 'EDITED', 'DONE') OR uploader IS NOT NULL), error TEXT, video_id TEXT, - video_link TEXT CHECK (state != 'DONE' OR video_link IS NOT NULL), + video_link TEXT CHECK ((NOT (state IN ('DONE', 'MODIFIED'))) OR video_link IS NOT NULL), editor TEXT, edit_time TIMESTAMP CHECK (state = 'UNEDITED' OR editor IS NOT NULL), - upload_time TIMESTAMP CHECK (state != 'DONE' OR upload_time IS NOT NULL), + upload_time TIMESTAMP CHECK ((NOT (state IN ('DONE', 'MODIFIED'))) OR upload_time IS NOT NULL), last_modified TIMESTAMP CHECK (state != 'MODIFIED' OR last_modified IS NOT NULL) );