moved post relations to own table

This commit is contained in:
2024-04-20 12:57:27 +02:00
parent 249fc4f761
commit f146bc05d9

View File

@@ -14,8 +14,6 @@ CREATE TABLE Posts
( (
id bigserial PRIMARY KEY, id bigserial PRIMARY KEY,
author bigserial REFERENCES Users(id) NOT NULL, author bigserial REFERENCES Users(id) NOT NULL,
reference bigserial REFERENCES Posts(id) NOT NULL,
-- init with (select last_val from posts_id_seq)
title varchar(255) NOT NULL, title varchar(255) NOT NULL,
content varchar(1023) NOT NULL, content varchar(1023) NOT NULL,
postDate timestamp WITH TIME ZONE NOT NULL DEFAULT now(), postDate timestamp WITH TIME ZONE NOT NULL DEFAULT now(),
@@ -23,6 +21,13 @@ CREATE TABLE Posts
deleted timestamp WITH TIME ZONE default NULL deleted timestamp WITH TIME ZONE default NULL
); );
CREATE TABLE Answers (
id bigserial PRIMARY KEY,
parent bigserial REFERENCES Posts,
child bigserial REFERENCES Posts,
deleted timestamp WITH TIME ZONE default NULL
);
CREATE TABLE Reaction CREATE TABLE Reaction
( (
id bigserial PRIMARY KEY, id bigserial PRIMARY KEY,