feat: 新增flyway数据的动态维护

新增flyway跟踪和执行版本化的迁移脚本
This commit is contained in:
weitang 2025-07-02 11:06:08 +08:00
parent 79d645477c
commit b48e4b51a0
2 changed files with 19 additions and 1 deletions

View File

@ -160,6 +160,16 @@
<artifactId>jcommander</artifactId> <artifactId>jcommander</artifactId>
<version>1.82</version> <version>1.82</version>
</dependency> </dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -33,7 +33,13 @@ spring:
max-lifetime: 1800000 max-lifetime: 1800000
connection-timeout: 30000 connection-timeout: 30000
connection-test-query: SELECT 1 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: cache:
jcache: jcache:
config: classpath:ehcache.xml # 指定Ehcache配置文件路径 config: classpath:ehcache.xml # 指定Ehcache配置文件路径
@ -80,6 +86,7 @@ logging:
org.springframework.security: ${LOG_LEVEL_SECURITY:WARN} org.springframework.security: ${LOG_LEVEL_SECURITY:WARN}
org.hibernate.SQL: ${LOG_LEVEL_SQL:WARN} org.hibernate.SQL: ${LOG_LEVEL_SQL:WARN}
org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_LEVEL_SQL_PARAMS:WARN} org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_LEVEL_SQL_PARAMS:WARN}
org.flywaydb: DEBUG
pattern: pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" 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" file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
@ -160,6 +167,7 @@ spring:
security: security:
jwt: jwt:
enabled: true enabled: true
logging: logging:
level: level:
root: WARN root: WARN