2021-08-26 17:50:27 +03:00
|
|
|
CREATE TABLE posts
|
|
|
|
(
|
|
|
|
id SERIAL NOT NULL,
|
2021-08-31 19:27:23 +03:00
|
|
|
|
|
|
|
is_parent BOOLEAN NOT NULL,
|
2021-08-31 22:10:24 +03:00
|
|
|
parent_id INT REFERENCES posts (id) NULL,
|
2021-08-31 19:27:23 +03:00
|
|
|
|
2021-08-31 22:10:24 +03:00
|
|
|
is_deleted BOOLEAN DEFAULT false NOT NULL,
|
2021-08-31 19:27:23 +03:00
|
|
|
|
2021-08-26 17:50:27 +03:00
|
|
|
title VARCHAR NOT NULL,
|
|
|
|
text TEXT NOT NULL,
|
|
|
|
is_sage BOOLEAN NOT NULL,
|
2021-08-31 19:27:23 +03:00
|
|
|
|
2021-08-26 17:50:27 +03:00
|
|
|
created_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
2021-08-31 19:27:23 +03:00
|
|
|
updated_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
|
|
|
|
|
|
|
PRIMARY KEY (id)
|
2021-08-26 17:50:27 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE files
|
|
|
|
(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
post_id INTEGER NOT NULL,
|
|
|
|
name VARCHAR NOT NULL,
|
|
|
|
ext VARCHAR NOT NULL,
|
|
|
|
size INTEGER NOT NULL,
|
2021-08-30 10:03:14 +03:00
|
|
|
created_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
2021-08-26 17:50:27 +03:00
|
|
|
FOREIGN KEY (post_id) REFERENCES posts (id)
|
|
|
|
);
|
2021-11-17 11:44:12 +03:00
|
|
|
|
|
|
|
CREATE TABLE migrations
|
|
|
|
(
|
|
|
|
id INT NOT NULL,
|
|
|
|
name VARCHAR NOT NULL,
|
|
|
|
created_at TIMESTAMP DEFAULT NOW() NOT NULL
|
|
|
|
)
|