-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathebtalk.sql
More file actions
144 lines (126 loc) · 6.8 KB
/
ebtalk.sql
File metadata and controls
144 lines (126 loc) · 6.8 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
-- 사용자 테이블
CREATE TABLE `USER` (
`ID` VARCHAR(30) primary key comment '사용자 아이디',
`EDU_NO` INT comment '교육과정 번호',
`PW` VARCHAR(100) NOT NULL comment '사용자 비밀번호',
`PHONE` VARCHAR(100) NOT NULL comment '사용자 전화번호',
`NAME` VARCHAR(30) NOT NULL comment '사용자 이름',
`PROFILE_IMG` VARCHAR(100) comment '프로필 사진 파일 이름',
`PROFILE_IMG_PATH` VARCHAR(200) comment '프로필 사진 파일 경로',
`APPROVE_YN` CHAR(1) DEFAULT 'n' comment '사용자 승인여부',
`DELETE_YN` CHAR(1) DEFAULT 'n' comment '사용자 탈퇴여부',
`CREATED_AT` DATETIME NOT NULL comment '가입일',
`ADMIN_YN` CHAR(1) DEFAULT 'n' comment '관리자 여부',
foreign key (`EDU_NO`) references edu_course(`NO`) on update set null
);
-- 교육과정 테이블
CREATE TABLE `EDU_COURSE` (
`NO` INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
`TYPE` VARCHAR(50) NOT NULL,
`STARTED_AT` DATETIME,
`FINISHED_AT` DATETIME
);
INSERT INTO EDU_COURSE(`NO`, `TYPE`, `STARTED_AT`, `FINISHED_AT`)
VALUES(1, '빅데이터를 활용한 JAVA 개발자', '2024-01-29', '2024-07-25');
INSERT INTO EDU_COURSE(`NO`, `TYPE`, `STARTED_AT`, `FINISHED_AT`)
VALUES(2, '빅데이터 기반 AI 전문가', '2024-01-29', '2024-07-25');
INSERT INTO EDU_COURSE(`NO`, `TYPE`, `STARTED_AT`, `FINISHED_AT`)
VALUES(3, '윈도우 플랫폼 기반 IoT 시스템 개발자', '2024-01-29', '2024-09-06');
-- 스터디 모집 테이블
create table study(
`NO` int auto_increment primary key comment '스터디 번호',
`USER_ID` varchar(30) not null comment '방장 아이디',
`TITLE` varchar(100) not null comment '제목',
`STARTED_AT` date not null comment '스터디 시작일',
`FINISHED_AT` date not null comment '스터디 종료일',
`COUNT` int not null comment '인원 수',
`CONTENT` text not null comment '내용',
`VIEWS` int default 0 comment '조회수',
`CREATED_AT` date comment '등록일'
);
-- 스터디 조원 테이블
create table study_mate(
`STUDY_NO` int comment '스터디 번호',
`user_id` varchar(30) comment '조원 아이디',
`approve_yn` char(1) default 'N' comment '스터디 승인여부',
foreign key(study_no) references study(no)
on delete cascade
on update cascade
);
-- 회고록 테이블
create table MEMOIR(
`NO` int auto_increment primary key comment '회고록 번호',
`M_CATEGORY_NO` int not null comment '카테고리 번호',
`STUDY_NO` int not null comment '스터디 번호',
`USER_ID` varchar(30) not null comment '사용자 아이디',
`CONTENT` text not null comment '내용',
`CREATED_AT` date comment '등록일'
);
-- 회고록 카테고리 테이블
create table MEMOIR_CATEGORY(
`NO` int auto_increment primary key comment '카테고리 번호',
`TYPE` varchar(30) not null comment '종류'
);
insert into MEMOIR_CATEGORY(`type`) values('Went_Well');
insert into MEMOIR_CATEGORY(`type`) values('To_Improve');
insert into MEMOIR_CATEGORY(`type`) values('To_Do_List');
-- 게시판 테이블
create table BOARD(
`NO` int auto_increment primary key comment '게시판 번호',
`USER_ID` varchar(30) not null comment '게시글 작성자',
`B_CATEGORY_NO` int not null comment '카테고리 번호',
`TITLE` varchar(100) not null comment '제목',
`CONTENT` text not null comment '내용',
`VIEWS` int default 0 comment '조회수',
`MODIFIED_AT` datetime comment '수정일',
`CREATED_AT` datetime comment '등록일'
);
-- 게시판 카테고리
create table CATEGORY(
`NO` int auto_increment primary key comment '카테고리 번호',
`TYPE` varchar(50) not null comment '종류'
);
insert into CATEGORY(`type`) values ('모집중');
insert into CATEGORY(`type`) values ('종료');
-- 게시판 카테고리(세부)
create table CATEGORYOFLOWER(
`NO` int auto_increment primary key comment '하위 카테고리 번호',
`C_NO` int not null comment '카테고리 번호',
`TYPE` varchar(50) not null comment '종류'
);
-- 댓글 테이블
create table COMMENT(
`NO` int auto_increment primary key comment '댓글 번호',
`USER_ID` varchar(30) not null comment '사용자 아이디',
`BOARD_NO` int not null comment '게시물 번호',
`CONTENT` text not null comment '내용',
`CREATED_AT` datetime not null comment '등록일'
);
-- 좋아요 테이블
create table FAVORITES(
`NO` int auto_increment primary key comment '좋아요 번호',
`USER_ID` varchar(30) not null comment '댓글 작성자',
`B_NO` int not null comment '게시물 번호'
);
-- 채팅방유저테이블
CREATE TABLE `ChatRoomUser` (
`CHAT_ROOM_NO` INT NOT NULL PRIMARY KEY,
`USER_ID` VARCHAR(30) NOT NULL
);
-- 메세지 테이블
CREATE TABLE `Message` (
`NO` INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
`FROM_ID` VARCHAR(30) NOT NULL COMMENT 'FOREIGN KEY (USER_ID) REFERENCES USER(ID) ON DELETE CASCADE',
`CHAT_ROOM_NO` INT NOT NULL,
`FILE_NO` INT NOT NULL,
`CONTENT` TEXT NULL,
`MESSAGE_TYPE` ENUM('TEXT', 'IMAGE') NOT NULL,
`CREATED_AT` DATETIME NOT NULL
);
-- 메시지 첨부 파일 테이블
CREATE TABLE `Attachment` (
`NO` INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
`FILE_PATH` VARCHAR(255) NOT NULL,
`FILE_TYPE` VARCHAR(50) NOT NULL,
`CREATED_AT` DATETIME NULL DEFAULT CURRENT_TIMESTAMP
);