mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
242abb8645
* feat: rename init migration * feat: add migration for is_archived field * fix: thread title wrap * fix: captcha checks after post validation now * fix * wip on migrate method * feat: decided to write own migrator * feat: add get files on folder func * wip * feat: add migrations table * feat: add migration method * doc * feat: query -> exec
36 lines
720 B
SQL
36 lines
720 B
SQL
CREATE TABLE posts
|
|
(
|
|
id SERIAL NOT NULL,
|
|
|
|
is_parent BOOLEAN NOT NULL,
|
|
parent_id INT REFERENCES posts (id) NULL,
|
|
|
|
is_deleted BOOLEAN DEFAULT false NOT NULL,
|
|
|
|
title VARCHAR NOT NULL,
|
|
text TEXT NOT NULL,
|
|
is_sage BOOLEAN NOT NULL,
|
|
|
|
created_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
|
updated_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
|
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE files
|
|
(
|
|
id SERIAL PRIMARY KEY,
|
|
post_id INTEGER NOT NULL,
|
|
name VARCHAR NOT NULL,
|
|
ext VARCHAR NOT NULL,
|
|
size INTEGER NOT NULL,
|
|
created_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
|
FOREIGN KEY (post_id) REFERENCES posts (id)
|
|
);
|
|
|
|
CREATE TABLE migrations
|
|
(
|
|
id INT NOT NULL,
|
|
name VARCHAR NOT NULL,
|
|
created_at TIMESTAMP DEFAULT NOW() NOT NULL
|
|
) |