Skip to content

Commit

Permalink
feat: flyway 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
songyi00 committed Jul 28, 2024
1 parent 54cab45 commit 827ed2e
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 6 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ dependencies {
// MySQL
runtimeOnly 'com.mysql:mysql-connector-j'

implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'

// jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'

Expand All @@ -55,6 +58,7 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

testImplementation 'io.rest-assured:rest-assured'

}

tasks.named('test') {
Expand Down
18 changes: 14 additions & 4 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
spring:
h2:
console:
enabled: true
path: /h2-console
datasource:
url: jdbc:mysql://localhost:3306/nexters
username: test
password: test
url: jdbc:h2:~/test;MODE=MYSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;
username: sa
jpa:
database-platform: org.hibernate.dialect.MySQLDialect
hibernate:
ddl-auto: update
ddl-auto: validate
data:
redis:
host: localhost
port: 6379
flyway:
enabled: true
baseline-on-migrate: true
url: jdbc:mysql://localhost:3306/nexters
user: test
password: test
baseline-version: 0

jwt:
secret: ${JWT_SECRET}
Expand Down
15 changes: 13 additions & 2 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,30 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${DB_USERNAME}
password: ${DB_PASSWORD}

jpa:
database-platform: org.hibernate.dialect.MySQLDialect
hibernate:
ddl-auto: update
ddl-auto: validate
properties:
hibernate:
format_sql: true
show-sql: false
open-in-view: false

data:
redis:
host: ${REDIS_HOST}
port: 6379

flyway:
enabled: true
baseline-on-migrate: true
url: jdbc:mysql://${DB_HOSTNAME}:${DB_PORT}/${DB_DATABASE}
user: ${DB_USERNAME}
password: ${DB_PASSWORD}
baseline-version: 0

jwt:
secret: ${JWT_SECRET}
access-token:
Expand All @@ -34,4 +44,5 @@ springdoc:
oauth:
apple:
iss: https://appleid.apple.com
client-id: ${OAUTH_APPLE_CLIENT_ID}
client-id: ${OAUTH_APPLE_CLIENT_ID}

33 changes: 33 additions & 0 deletions src/main/resources/db/migration/V1__init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
create table if not exists nexters.member
(
member_id bigint auto_increment
primary key,
created_at datetime(6) null,
deleted_at datetime(6) null,
updated_at datetime(6) null,
character_type varchar(255) null,
email varchar(255) not null,
nickname varchar(255) null,
social_id varchar(255) null,
social_type varchar(255) null,
constraint uk_member__social_id
unique (social_id)
);

create table if not exists nexters.mission
(
mission_id bigint auto_increment
primary key,
created_at datetime(6) null,
deleted_at datetime(6) null,
updated_at datetime(6) null,
board_count int not null,
description varchar(255) not null,
host_member_id bigint not null,
invitation_code varchar(255) not null,
mission_day varchar(255) not null,
mission_end_date datetime(6) not null,
mission_start_date datetime(6) not null,
upload_end_time varchar(255) not null,
upload_start_time varchar(255) not null
);

0 comments on commit 827ed2e

Please sign in to comment.