create user 'spring'@'%' identified by 'bitc5600';
GRANT ALL PRIVILEGES ON *.* TO 'spring'@'%';
create database spring;
use spring;
CREATE TABLE user(
id int auto_increment primary key,
username varchar(100) unique not null,
password varchar(100) not null,
email varchar(100),
profile varchar(200),
createDate timestamp
) engine=InnoDB default charset=utf8;
CREATE TABLE post(
id int auto_increment primary key,
title varchar(100) not null,
content longtext,
userId int,
createDate timestamp,
foreign key (userId) references user (id) on delete set null
) engine=InnoDB default charset=utf8;
CREATE TABLE comment(
id int auto_increment primary key,
userId int,
postId int,
content varchar(300) not null,
createDate timestamp,
foreign key (userId) references user (id) on delete set null,
foreign key (postId) references post (id) on delete cascade
) engine=InnoDB default charset=utf8;
'Server > Spring Boot' 카테고리의 다른 글
spring boot // PostMapping (0) | 2020.07.27 |
---|---|
spring boot // DI 의존성 주입 (0) | 2020.07.27 |
spring boot // 200727 // 블로그 글목록보기 / 삭제하기 / 수정하기 (0) | 2020.07.27 |
spring boot // 200724 // RestController / webMvcConfigurer / 인터셉터 / 인증 / 권한 / 익셉션 예외 / 글쓰기 / (0) | 2020.07.24 |
spring boot //200720 // (0) | 2020.07.20 |