From f146bc05d989d5163417a30af5dd5f20e1d92037 Mon Sep 17 00:00:00 2001 From: timoschneider Date: Sat, 20 Apr 2024 12:57:27 +0200 Subject: [PATCH] moved post relations to own table --- init/00_InitDB.sql | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/init/00_InitDB.sql b/init/00_InitDB.sql index ef79d71..bf720ff 100644 --- a/init/00_InitDB.sql +++ b/init/00_InitDB.sql @@ -14,8 +14,6 @@ CREATE TABLE Posts ( id bigserial PRIMARY KEY, 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, content varchar(1023) NOT NULL, postDate timestamp WITH TIME ZONE NOT NULL DEFAULT now(), @@ -23,6 +21,13 @@ CREATE TABLE Posts 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 ( id bigserial PRIMARY KEY,