Skip to content

Commit

Permalink
hotfix: 약속 이름에 이모지 입력 시 약속 개설 안 됨 (#598)
Browse files Browse the repository at this point in the history
* fix: 데이터베이스, 테이블 character set 변경

* fix: h2, mysql 방언 해결을 위해 h2 url 수정

* fix: mysql에서만 수행되도록 sql 수정

* feat: flyway repair
  • Loading branch information
mzeong authored Sep 26, 2024
1 parent 77af34d commit 6127bc6
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
17 changes: 17 additions & 0 deletions backend/src/main/java/com/ody/common/config/FlywayConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.ody.common.config;

import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FlywayConfig {

@Bean
public FlywayMigrationStrategy repairMigrateStrategy() {
return flyway -> {
flyway.repair();
flyway.migrate();
};
}
}
4 changes: 0 additions & 4 deletions backend/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ spring:
jpa:
hibernate:
ddl-auto: validate
defer-datasource-initialization: false
sql:
init:
mode: never
Expand All @@ -11,9 +10,6 @@ spring:
url: ENC(KUJNgDMlvi/imeVHjCO2QekgI4DNxZT9IrW0QlVVkJXJUUQ2DAUOqI91FVH7aFhXVCsfXtf0EUmF/JqN3GpXa/mVj3o4BNbqS3QsU50BgwEEodko+VwHY2ebDHUxlKA1/FXBSmu6p+Rd3rcNEzoBIA==)
username: ENC(jNYhZN6xMCmPQ7GZM+Hu3A==)
password: ENC(VRtr3RjM+XnPvRdLjrPMHyTSzDlEjR7o)
flyway:
enabled: true
baseline-on-migrate: true

log:
file:
Expand Down
7 changes: 2 additions & 5 deletions backend/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ spring:
web-allow-others: true
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:database?serverTimezone=Asia/Seoul
url: jdbc:h2:mem:database?serverTimezone=Asia/Seoul;MODE=MYSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE
username: sa
password:
jpa:
hibernate:
ddl-auto: validate
defer-datasource-initialization: false
dialect: org.hibernate.dialect.MySQLDialect
sql:
init:
mode: always
flyway:
enabled: true
baseline-on-migrate: true

log:
file:
Expand Down
4 changes: 0 additions & 4 deletions backend/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ spring:
jdbc-url: jdbc:mysql://database-project.cluster-ro-cqsc6pyqhwww.ap-northeast-2.rds.amazonaws.com:3306/ody
username: ody
password: ENC(2n3gUzzFjknXpHDYwuF4d5BQw6XqLdsX)
defer-datasource-initialization: false
flyway:
enabled: true
baseline-on-migrate: true

log:
file:
Expand Down
4 changes: 4 additions & 0 deletions backend/src/main/resources/common.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
spring:
jpa:
open-in-view: false
defer-datasource-initialization: false
flyway:
enabled: true
baseline-on-migrate: true

springdoc:
default-consumes-media-type: application/json;charset=UTF-8
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*!50001
ALTER DATABASE ody CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE member CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE meeting CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE mate CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE notification CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE eta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
*/
3 changes: 2 additions & 1 deletion backend/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ spring:
settings:
web-allow-others: true
datasource:
url: jdbc:h2:mem:database
url: jdbc:h2:mem:database;MODE=MYSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE
username: sa
password:
driver-class-name: org.h2.Driver
jpa:
show-sql: true
hibernate:
ddl-auto: create-drop
dialect: org.hibernate.dialect.MySQLDialect
properties:
hibernate:
format_sql: true
Expand Down

0 comments on commit 6127bc6

Please sign in to comment.