Merge branch 'main' of git.hackbever.be:rusty-bever/blog

This commit is contained in:
Jef Roosens 2021-12-25 10:43:02 +01:00
commit 5b465867e6
Signed by: Jef Roosens
GPG key ID: 955C0660072F691F
6 changed files with 22 additions and 5 deletions

View file

@ -5,5 +5,6 @@ drop function enforce_version_titles;
drop index sections_shortname_index;
drop table versions cascade;
drop table tags cascade;
drop table posts cascade;
drop table sections cascade;

View file

@ -48,7 +48,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 $$