Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions domain-mysql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies {
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

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

//Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.kernelsquare.domainmysql.config;

import jakarta.annotation.PostConstruct;
import org.flywaydb.core.Flyway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;

import javax.sql.DataSource;

@Configuration
public class FlywayConfig {

@Autowired
private DataSource dataSource;

@PostConstruct
public void migrateFlyway() {
Flyway flyway = Flyway.configure()
.dataSource(dataSource)
.load();

flyway.repair();

flyway.migrate();
}

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {
LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
emfb.setDataSource(dataSource);
emfb.setPackagesToScan("com.kernelsquare.domainmysql");
emfb.setJpaVendorAdapter(jpaVendorAdapter);
return emfb;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE `chat_room`
ADD COLUMN `expiration_date` datetime NOT NULL DEFAULT '2099-12-31T00:00:00';

ALTER TABLE `chat_room`
MODIFY `expiration_date` datetime NOT NULL;

This file was deleted.

63 changes: 27 additions & 36 deletions member-api/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,49 @@
spring:
datasource:
# ToDo service test 부분 mocking 작업이 끝나면 추가 작업할 예정
# url: ${TEST_DB_URL}
# url: jdbc:h2:mem:test_kernel_square;MODE=MySQL
url: jdbc:h2:mem:test_kernel_square
driver-class-name: org.h2.Driver
username: ${LOCAL_DB_HOST}
password: ${LOCAL_DB_PASSWORD}

flyway:
enabled: false

security:
jwt:
header: Authorization
secret: ${JWT_SECRET_KEY}
access-token-validity-in-seconds: 3600 # 1시간
refresh-token-validity-in-seconds: 1_209_600 # 2주
url: ${TEST_DB_URL}?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&characterEncoding=UTF-8
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${TEST_DB_HOST}
password: ${TEST_DB_PASSWORD}

jpa:
hibernate:
ddl-auto: create
ddl-auto: none

properties:
hibernate:
# show-sql: true
format_sql: true
# dialect: org.hibernate.dialect.MySQL5InnoDBDialect

database-platform: org.hibernate.dialect.H2Dialect
database: mysql

defer-datasource-initialization: true

sql:
init:
mode: never
database-platform: org.hibernate.dialect.MySQL8Dialect

jackson:
property-naming-strategy: SNAKE_CASE

# data:
# redis:
# host: localhost
# port: 6380

redis:
serialization:
class-property-type-name: RefreshToken.class

data:
mongodb:
uri: ${MONGO_TEST_URI}

security:
jwt:
header: Authorization
secret: ${JWT_SECRET_KEY}
access-token-validity-in-seconds: 3600 # 1시간
refresh-token-validity-in-seconds: 1_209_600 # 2주

flyway:
enabled: false
baseline-on-migrate: true

logging.level:
org.hibernate.SQL: debug
# org.hibernate.type: trace
org.springframework.security: debug

custom:
domain:
image:
baseUrl: ${BASE_URL}

cloud:
aws:
s3:
Expand All @@ -67,3 +53,8 @@ cloud:
credentials:
accessKey: ${AWS_ACCESS_KEY}
secretKey: ${AWS_ACCESS_SECRET}

custom:
domain:
image:
baseUrl: ${BASE_URL}