Added tags table

This commit is contained in:
Jef Roosens 2021-12-23 23:28:26 +01:00
parent b80a060faf
commit 8284438576
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30
3 changed files with 18 additions and 1 deletions

View file

@ -46,7 +46,14 @@ create table versions (
-- This check allows draft posts to be created without having to enter a
-- publish date, but forces them to have one if they're not a draft.
CHECK (is_draft OR publish_date IS NOT NULL)
CONSTRAINT no_null_published_date CHECK (is_draft OR publish_date IS NOT NULL)
);
create table tags (
post_id uuid NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
value varchar(64) NOT NULL,
PRIMARY KEY (post_id, value)
);
create function enforce_version_titles() returns trigger as $$