2017-08-08 10:01:06 +07:00
|
|
|
create table users (
|
2017-08-14 13:27:36 +07:00
|
|
|
id varchar(255) primary key,
|
|
|
|
username varchar(255) UNIQUE,
|
2017-08-08 10:01:06 +07:00
|
|
|
password varchar(255),
|
|
|
|
email varchar(255) UNIQUE,
|
|
|
|
bio text,
|
|
|
|
image varchar(511)
|
|
|
|
);
|
2017-08-15 09:47:18 +07:00
|
|
|
|
|
|
|
create table articles (
|
|
|
|
id varchar(255) primary key,
|
|
|
|
user_id varchar(255),
|
|
|
|
slug varchar(255) UNIQUE,
|
|
|
|
title varchar(255),
|
|
|
|
description text,
|
|
|
|
body text,
|
|
|
|
created_at TIMESTAMP NOT NULL,
|
|
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
);
|
|
|
|
|
|
|
|
create table article_favorites (
|
|
|
|
article_id varchar(255) not null,
|
|
|
|
user_id varchar(255) not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table follows (
|
|
|
|
user_id varchar(255) not null,
|
|
|
|
follow_id varchar(255) not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table tags (
|
|
|
|
id varchar(255) primary key,
|
|
|
|
name varchar(255)
|
|
|
|
);
|
|
|
|
|
|
|
|
create table article_tags (
|
|
|
|
article_id varchar(255) not null,
|
|
|
|
tag_id varchar(255) not null
|
|
|
|
);
|
2017-08-15 15:36:07 +07:00
|
|
|
|
|
|
|
create table comments (
|
|
|
|
id varchar(255) primary key,
|
|
|
|
body text,
|
|
|
|
article_id varchar(255),
|
|
|
|
user_id varchar(255),
|
|
|
|
created_at TIMESTAMP NOT NULL,
|
|
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
);
|