-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschedule.sql
More file actions
42 lines (37 loc) · 1.27 KB
/
schedule.sql
File metadata and controls
42 lines (37 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use `schedule-develop`;
# 멤버 테이블 삭제
DROP TABLE member;
# 멤버 테이블 생성
CREATE TABLE member (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
created_at DATETIME NOT NULL,
modified_at DATETIME NOT NULL
);
# 일정 테이블 삭제
DROP TABLE schedule;
# 일정 테이블 생성
CREATE TABLE schedule (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
member_id BIGINT NOT NULL,
title VARCHAR(255) NOT NULL,
contents VARCHAR(255) NOT NULL,
created_at DATETIME NOT NULL,
modified_at DATETIME NOT NULL,
CONSTRAINT fk_member_s FOREIGN KEY (member_id) REFERENCES MEMBER (id)
);
# 댓글 테이블 삭제
DROP TABLE comment;
# 댓글 테이블 생성
CREATE TABLE comment (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
member_id BIGINT NOT NULL,
schedule_id BIGINT NOT NULL,
contents VARCHAR(255) NOT NULL,
created_at DATETIME NOT NULL,
modified_at DATETIME NOT NULL,
CONSTRAINT fk_member_c FOREIGN KEY (member_id) REFERENCES MEMBER (id),
CONSTRAINT fk_schedule FOREIGN KEY (schedule_id) REFERENCES SCHEDULE (id)
);