AMYMEME / board-golang

simple board website using golang
MIT License
0 stars 0 forks source link

DB #1

Closed AMYMEME closed 4 years ago

AMYMEME commented 4 years ago

게시판 DB 설계 및 연결

AMYMEME commented 4 years ago
CREATE TABLE oauth
(
provider varchar(30) not null,
provider_id varchar(30) not null,
id int auto_increment primary key not null
);

CREATE TABLE member
(
id int primary key not null references oauth(id) ON DELETE CASCADE ON UPDATE CASCADE,
name varchar(30) not null,
level TINYINT not null
);

CREATE TABLE post
(
id int auto_increment primary key not null,
member_id int not null references member(id) ON UPDATE CASCADE,
title varchar(50) not null,
contents LONGTEXT not null,
datetime TIMESTAMP not null
);

CREATE TABLE comment
(
id int auto_increment primary key not null,
member_id int not null references member(id) ON UPDATE CASCADE,
post_id int not null references post(id) ON UPDATE CASCADE ON DELETE CASCADE,
datetime TIMESTAMP not null,
contents VARCHAR(255) not null
);