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;
반응형
'SpringBoot' 카테고리의 다른 글
Spring-Boot Blog Project 3. 회원가입 화면 구현하기 (0) | 2020.07.20 |
---|---|
Spring-Boot Blog Project 2. nav, footer 제작 (0) | 2020.07.20 |
SpringBoot, jsp] application에서 프리픽스, 서픽스 설정 후 경로 설정했을 때도 404 Error 발생 시 해결법 (0) | 2020.07.20 |
톰캣과 서비스 어노테이션 (0) | 2020.07.17 |
Consider defining a bean of type 'package' in your configuration [Spring-Boot] 해결 (0) | 2020.07.17 |