add handler, html templates, Makefile and migrations
This commit is contained in:
commit
a06e8db2ff
22 changed files with 1001 additions and 0 deletions
3
migrations/1_create_tables.down.sql
Normal file
3
migrations/1_create_tables.down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
DROP TABLE comments;
|
||||
DROP TABLE posts;
|
||||
DROP TABLE threads;
|
20
migrations/1_create_tables.up.sql
Normal file
20
migrations/1_create_tables.up.sql
Normal file
|
@ -0,0 +1,20 @@
|
|||
CREATE TABLE threads (
|
||||
id UUID PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
description TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE posts (
|
||||
id UUID PRIMARY KEY,
|
||||
thread_id UUID NOT NULL REFERENCES threads(id) ON DELETE CASCADE,
|
||||
title TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
votes INT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE comments (
|
||||
id UUID PRIMARY KEY,
|
||||
post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
||||
content TEXT NOT NULL,
|
||||
votes INT NOT NULL
|
||||
);
|
Reference in a new issue