1
Fork 0

core: Add subject column

This commit is contained in:
Steffo 2024-11-16 07:43:54 +01:00
parent 0e7aacdd0e
commit 5078b41499
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
3 changed files with 8 additions and 0 deletions

View file

@ -2,8 +2,14 @@ CREATE TABLE IF NOT EXISTS meta_subjects (
id UUID DEFAULT gen_random_uuid(),
document BPCHAR NOT NULL,
pattern BPCHAR NOT NULL,
subject BPCHAR,
redirect BPCHAR,
CONSTRAINT either_subject_or_redirect_not_null CHECK (
(subject IS NOT NULL AND redirect IS NULL)
OR
(subject IS NULL AND redirect IS NOT NULL)
),
PRIMARY KEY (id)
);

View file

@ -11,6 +11,7 @@ pub struct MetaSubject {
pub id: Uuid,
pub document: String,
pub pattern: String,
pub subject: Option<String>,
pub redirect: Option<String>,
}

View file

@ -55,6 +55,7 @@ diesel::table! {
id -> Uuid,
document -> Bpchar,
pattern -> Bpchar,
subject -> Nullable<Bpchar>,
redirect -> Nullable<Bpchar>,
}
}