-
Notifications
You must be signed in to change notification settings - Fork 7
Conversation
spring: | ||
h2: | ||
console: | ||
enabled: true | ||
jpa: | ||
show-sql: true | ||
hibernate: | ||
ddl-auto: update | ||
properties: | ||
hibernate: | ||
dialect: org.hibernate.dialect.H2Dialect | ||
format_sql: true | ||
datasource: | ||
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver | ||
url: jdbc:tc:mysql:8:/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
application-test.yml
파일을 test폴더로 옮기면 동작에 문제가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
동작되어서 수정했습니다!
src/main/resources/sql/schema.sql
Outdated
CREATE TABLE `product` ( | ||
id bigint not null auto_increment, | ||
title varchar(16) not null, | ||
description varchar(500) not null, | ||
minimum_price int not null, | ||
category varchar(100) not null, | ||
location varchar(100), | ||
expire_at datetime not null, | ||
created_at datetime, | ||
updated_at datetime, | ||
primary key (id) | ||
); | ||
|
||
CREATE TABLE `image` ( | ||
id bigint not null auto_increment, | ||
product_id bigint, | ||
url varchar(512) not null, | ||
`order` int not null, | ||
created_at datetime, | ||
updated_at datetime, | ||
primary key (id) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
자동 포멧팅 한번 돌리면 좋을것 같습니다.👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 알겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image 에 외래키 빠진것 같습니다!
CONSTRAINT fk_product_id_for_image FOREIGN KEY (product_id) REFERENCES `product` (id) ON DELETE RESTRICT ON UPDATE RESTRICT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우어어 감사합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
주요 사항
테스트 하는 법
@Sql
: 테스트코드 실행되기 전에 설정된 테이블 생성 sql(+ 초기 데이터) 스크립트를 실행할 수 있게 해줌@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
: 내장 DB를 사용하지 않는 것으로 설정하여 docker MySQL를 사용리뷰 받고 싶은 부분
잘못된 부분과 컨벤션 맞추고 싶은 부분 있으면 피드백 부탁드립니다.