diff --git a/src/main/resources/sql/article.sql b/src/main/resources/sql/article.sql deleted file mode 100644 index eeb2a4e..0000000 --- a/src/main/resources/sql/article.sql +++ /dev/null @@ -1,10 +0,0 @@ -create table article( - id bigint not null, - content varchar(255), - created_at timestamp(6), - title varchar(255), - updated_at timestamp(6), - writer varchar(255), - primary key (id) -); - diff --git a/src/main/resources/sql/comment.sql b/src/main/resources/sql/comment.sql deleted file mode 100644 index 9e796c3..0000000 --- a/src/main/resources/sql/comment.sql +++ /dev/null @@ -1,10 +0,0 @@ -create table comment( - id bigint not null primary key, - content varchar(255), - created_at timestamp(6), - updated_at timestamp(6), - writer varchar(255), - article_id bigint, - - constraint article_id_ref foreign key (article_id) references article(id) on update cascade -); \ No newline at end of file diff --git a/src/main/resources/sql/domain.sql b/src/main/resources/sql/domain.sql new file mode 100644 index 0000000..e5e5eb3 --- /dev/null +++ b/src/main/resources/sql/domain.sql @@ -0,0 +1,29 @@ +USE board; + +CREATE TABLE article( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + writer VARCHAR(255), + created_at DATETIME, + updated_at DATETIME +); + +CREATE TABLE comment( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + writer VARCHAR(255), + content TEXT, + created_at DATETIME, + updated_at DATETIME, + article_id BIGINT, + FOREIGN KEY (article_id) REFERENCES Article(id) +); + +CREATE TABLE user ( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + email VARCHAR(45) UNIQUE NOT NULL, + password VARCHAR(255), + name VARCHAR(255), + nickname VARCHAR(255), + profile_image LONGBLOB +); \ No newline at end of file diff --git a/src/main/resources/sql/user.sql b/src/main/resources/sql/user.sql deleted file mode 100644 index 37a2ab4..0000000 --- a/src/main/resources/sql/user.sql +++ /dev/null @@ -1,8 +0,0 @@ -create table user( - id bigint not null, - email varchar(45) not null primary key, - name varchar(255), - nickname varchar(255), - password varchar(255), - profile_image BLOB -); \ No newline at end of file