Skip to content

Commit e55216c

Browse files
committed
Add database integration and initial member table setup
Added dependencies for MySQL and Flyway in `build.gradle`. Configured MySQL connection and Flyway settings in `application.yml`. Included an initial migration script to create the `member` table with unique constraints. Replaced `application.properties` with `application.yml`.
1 parent 6586540 commit e55216c

File tree

6 files changed

+37
-2
lines changed

6 files changed

+37
-2
lines changed

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spring-boot/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ dependencies {
2929
developmentOnly 'org.springframework.boot:spring-boot-devtools'
3030
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
3131
annotationProcessor 'org.projectlombok:lombok'
32+
33+
implementation 'com.mysql:mysql-connector-j:9.2.0'
34+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
35+
implementation 'org.flywaydb:flyway-core:11.3.1'
36+
implementation 'org.flywaydb:flyway-mysql:11.3.1'
37+
38+
3239
testImplementation 'org.springframework.boot:spring-boot-starter-test'
3340
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
3441
}

spring-boot/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.8'
22
services:
33
template:
4-
image: mysql:latest
4+
image: mysql:9.2.0
55

66
# 애플 실리콘 맥을 사용하는 경우 아래 platform 을 주석처리 해제
77
# platform: linux/amd64

spring-boot/src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
spring:
2+
datasource:
3+
url: jdbc:mysql://localhost:3306/template?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
4+
username: root
5+
password: test1234
6+
driver-class-name: com.mysql.cj.jdbc.Driver
7+
8+
jpa:
9+
database-platform: org.hibernate.dialect.MySQL8Dialect
10+
database: mysql
11+
hibernate:
12+
ddl-auto: update
13+
show-sql: true
14+
properties:
15+
hibernate.format_sql: true
16+
17+
18+
flyway:
19+
enabled: true
20+
baseline-on-migrate: true
21+
locations: classpath:db/migration
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
create table member (
2+
member_key int auto_increment primary key,
3+
member_code varchar(50) not null,
4+
first_name varchar(50) not null,
5+
last_name varchar(50) not null,
6+
constraint unique_member_code unique (member_code)
7+
);

0 commit comments

Comments
 (0)