Skip to content

Commit 806150f

Browse files
committed
build: flyway 추가
1 parent 2b983ee commit 806150f

File tree

7 files changed

+48
-21
lines changed

7 files changed

+48
-21
lines changed

build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ dependencies {
2626
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
2727
implementation 'org.mindrot:jbcrypt:0.4'
2828
implementation 'net.nurigo:sdk:4.3.0'
29+
implementation 'org.flywaydb:flyway-core'
30+
implementation 'org.flywaydb:flyway-mysql'
2931
}
3032

3133
tasks.named('test') {

src/main/java/com/example/busan/auth/domain/PasswordEncoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@Component
77
public class PasswordEncoder {
8-
8+
99
public String encode(final String password) {
1010
return BCrypt.hashpw(password, BCrypt.gensalt());
1111
}

src/main/java/com/example/busan/reservation/ReservationController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public ResponseEntity<Void> create(@RequestBody final CreateReservationRequest r
3838
}
3939

4040
@DeleteMapping("/{reservationId}")
41-
public ResponseEntity<Void> create(@PathVariable("reservationId") final Long id,
41+
public ResponseEntity<Void> delete(@PathVariable("reservationId") final Long id,
4242
@Authorized final Authentication authentication,
4343
@RequestBody final CancelReservationRequest request) {
4444
reservationService.deleteById(id, authentication.email(), request);

src/main/resources/application.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
spring:
22
jpa:
33
hibernate:
4-
ddl-auto: create-drop
4+
ddl-auto: validate
55
show-sql: true
66
properties:
77
hibernate:
@@ -11,6 +11,8 @@ spring:
1111
url: jdbc:mysql://localhost:20000/busan
1212
username: root
1313
password: password
14+
flyway:
15+
baseline-version: 0
1416

1517
phone:
1618
key: testesttstset
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CREATE TABLE IF NOT EXISTS member
2+
(
3+
company VARCHAR(255) NOT NULL,
4+
email VARCHAR(255) PRIMARY KEY,
5+
name VARCHAR(255) NOT NULL,
6+
password VARCHAR(255) NOT NULL,
7+
phone VARCHAR(255) NOT NULL,
8+
region ENUM ('BUSAN','GANGNEUNG') NOT NULL,
9+
role ENUM ('ADMIN','USER') NOT NULL
10+
) ENGINE = InnoDB;
11+
12+
CREATE TABLE IF NOT EXISTS reservation
13+
(
14+
created_time DATETIME(6) NOT NULL,
15+
end_time DATETIME(6) NOT NULL,
16+
id BIGINT PRIMARY KEY AUTO_INCREMENT,
17+
room_id BIGINT NOT NULL,
18+
start_time DATETIME(6) NOT NULL,
19+
cancel_reason VARCHAR(1000),
20+
reservation_email VARCHAR(255) NOT NULL,
21+
status ENUM ('CANCELED','RESERVED') NOT NULL
22+
) ENGINE = InnoDB;
23+
24+
CREATE TABLE IF NOT EXISTS room
25+
(
26+
max_people_count INT NOT NULL,
27+
id BIGINT PRIMARY KEY AUTO_INCREMENT,
28+
image VARCHAR(1000) NOT NULL,
29+
name VARCHAR(255) NOT NULL
30+
) ENGINE = InnoDB;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
INSERT INTO member (company, email, name, password, phone, region, role)
2+
VALUES ('Test Company', '[email protected]', '황재현', '$2a$10$xCaPPCpZXGL2dmQb4QuKjeSgWFi15Y4kbrsc8z084A71JJicqh67O',
3+
'01011112222', 'BUSAN', 'ADMIN');
4+
5+
INSERT INTO room (max_people_count, image, name)
6+
VALUES (14,
7+
'https://www.lottehotel.com/content/dam/lotte-hotel/city/daejeon/facilities/business/180708-8-2000-fac-daejeon-city.jpg.thumb.768.768.jpg',
8+
'대회의실'),
9+
(10, 'https://www.kmeetingroom.com/_storage/thumbnails/oUkUjbSJ51FlnZEh72cJniGZPv0nXUUclTrvIYxD.jpg', '중회의실'),
10+
(7, 'https://mediahub.seoul.go.kr/uploads/mediahub/2021/04/fIoyiYBFcMltsFcfRYSJRXSUEOCfAxuR.png', '대회의실 2'),
11+
(20, 'https://velog.velcdn.com/images/movie/post/f54ab19f-fa2d-4dbe-8e70-4970fff4724f/image.jpeg', '잠실 캠퍼스');

src/test/resources/application.yaml

-18
This file was deleted.

0 commit comments

Comments
 (0)