From 045dcf6fd28b8923d4a3cd2cf64cd1206b533caf Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Tue, 31 Aug 2021 19:27:23 +0300 Subject: [PATCH] feat: remove threads table from migration --- migrations/1-init.sql | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/migrations/1-init.sql b/migrations/1-init.sql index b67dcd2..255b747 100644 --- a/migrations/1-init.sql +++ b/migrations/1-init.sql @@ -1,25 +1,22 @@ -- UP --- Threads -CREATE TABLE threads -( - id SERIAL NOT NULL, - is_deleted BOOLEAN NOT NULL, - created_at TIMESTAMP DEFAULT NOW() NOT NULL, - updated_at TIMESTAMP DEFAULT NOW() NOT NULL, - PRIMARY KEY (id) -); - -- Posts CREATE TABLE posts ( id SERIAL NOT NULL, - thread_id INTEGER NOT NULL, + + is_parent BOOLEAN NOT NULL, + parent_id INT REFERENCES posts (id), + + is_deleted BOOLEAN NOT NULL, + title VARCHAR NOT NULL, text TEXT NOT NULL, is_sage BOOLEAN NOT NULL, + created_at TIMESTAMP DEFAULT NOW() NOT NULL, - PRIMARY KEY (id), - FOREIGN KEY (thread_id) REFERENCES threads (id) + updated_at TIMESTAMP DEFAULT NOW() NOT NULL, + + PRIMARY KEY (id) ); @@ -39,5 +36,4 @@ CREATE TABLE files -- DOWN DROP TABLE files; -DROP TABLE posts; -DROP TABLE threads; \ No newline at end of file +DROP TABLE posts; \ No newline at end of file