DROP TABLE IF EXISTS Users; DROP TABLE IF EXISTS Posts; DROP TABLE IF EXISTS Answers; DROP TABLE IF EXISTS Reaction; CREATE TABLE Users ( id bigserial PRIMARY KEY, username varchar(255) NOT NULL, password varchar(255) NOT NULL, deleted timestamp WITH TIME ZONE default NULL ); CREATE TABLE Posts ( id bigserial PRIMARY KEY, author bigserial REFERENCES Users(id) NOT NULL, title varchar(255) NOT NULL, content varchar(1023) NOT NULL, postDate timestamp WITH TIME ZONE NOT NULL DEFAULT now(), postLocation Point NOT NULL, deleted timestamp WITH TIME ZONE default NULL ); CREATE TABLE Comments ( id bigserial PRIMARY KEY, parent bigserial REFERENCES Posts NOT NULL, child bigserial REFERENCES Posts NOT NULL, deleted timestamp WITH TIME ZONE default NULL ); CREATE TABLE Reaction ( id bigserial PRIMARY KEY, userid bigserial REFERENCES Users NOT NULL, post bigserial REFERENCES Posts(id) NOT NULL, positive boolean DEFAULT NULL, deleted timestamp WITH TIME ZONE default NULL )