diff --git a/backend/pom.xml b/backend/pom.xml index 79aeffd..628ac39 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -160,6 +160,16 @@ jcommander 1.82 + + + org.flywaydb + flyway-core + + + + org.flywaydb + flyway-mysql + diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 168beca..ffcd210 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -33,7 +33,13 @@ spring: max-lifetime: 1800000 connection-timeout: 30000 connection-test-query: SELECT 1 - + flyway: + enabled: true + table: flyway_schema_history + validate-on-migrate: true + locations: classpath:db/migration + baseline-on-migrate: true + out-of-order: true cache: jcache: config: classpath:ehcache.xml # 指定Ehcache配置文件路径 @@ -80,6 +86,7 @@ logging: org.springframework.security: ${LOG_LEVEL_SECURITY:WARN} org.hibernate.SQL: ${LOG_LEVEL_SQL:WARN} org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_LEVEL_SQL_PARAMS:WARN} + org.flywaydb: DEBUG pattern: console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" @@ -160,6 +167,7 @@ spring: security: jwt: enabled: true + logging: level: root: WARN