升级jimu版本至1.7.3,屏蔽flyway

pull/6036/head
EightMonth 2024-03-25 10:52:37 +08:00
parent 06b41ae479
commit e923654161
2 changed files with 38 additions and 40 deletions

View File

@ -2,8 +2,6 @@ package org.jeecg.config.flyway;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.FlywayException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -96,41 +94,41 @@ public class FlywayConfig {
@Value("${spring.flyway.clean-disabled:true}") @Value("${spring.flyway.clean-disabled:true}")
private Boolean cleanDisabled; private Boolean cleanDisabled;
@Bean // @Bean
public void migrate() { // public void migrate() {
if(!enabled){ // if(!enabled){
return; // return;
} // }
//
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource; // DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
Map<String, DataSource> dataSources = ds.getDataSources(); // Map<String, DataSource> dataSources = ds.getDataSources();
dataSources.forEach((k, v) -> { // dataSources.forEach((k, v) -> {
if("master".equals(k)){ // if("master".equals(k)){
String databaseType = environment.getProperty("spring.datasource.dynamic.datasource." + k + ".url"); // String databaseType = environment.getProperty("spring.datasource.dynamic.datasource." + k + ".url");
if (databaseType != null && databaseType.contains("mysql")) { // if (databaseType != null && databaseType.contains("mysql")) {
try { // try {
Flyway flyway = Flyway.configure() // Flyway flyway = Flyway.configure()
.dataSource(v) // .dataSource(v)
.locations(locations) // .locations(locations)
.encoding(encoding) // .encoding(encoding)
.sqlMigrationPrefix(sqlMigrationPrefix) // .sqlMigrationPrefix(sqlMigrationPrefix)
.sqlMigrationSeparator(sqlMigrationSeparator) // .sqlMigrationSeparator(sqlMigrationSeparator)
.placeholderPrefix(placeholderPrefix) // .placeholderPrefix(placeholderPrefix)
.placeholderSuffix(placeholderSuffix) // .placeholderSuffix(placeholderSuffix)
.sqlMigrationSuffixes(sqlMigrationSuffixes) // .sqlMigrationSuffixes(sqlMigrationSuffixes)
.validateOnMigrate(validateOnMigrate) // .validateOnMigrate(validateOnMigrate)
.baselineOnMigrate(baselineOnMigrate) // .baselineOnMigrate(baselineOnMigrate)
.cleanDisabled(cleanDisabled) // .cleanDisabled(cleanDisabled)
.load(); // .load();
flyway.migrate(); // flyway.migrate();
log.info("【升级提示】平台集成了MySQL库的Flyway数据库版本自动升级! "); // log.info("【升级提示】平台集成了MySQL库的Flyway数据库版本自动升级! ");
} catch (FlywayException e) { // } catch (FlywayException e) {
log.error("【升级提示】flyway执行sql脚本失败", e); // log.error("【升级提示】flyway执行sql脚本失败", e);
} // }
} else { // } else {
log.warn("【升级提示】平台只集成了MySQL库的Flyway实现了数据库版本自动升级! 其他类型的数据库,您可以考虑手工升级~"); // log.warn("【升级提示】平台只集成了MySQL库的Flyway实现了数据库版本自动升级! 其他类型的数据库,您可以考虑手工升级~");
} // }
} // }
}); // });
} // }
} }

View File

@ -57,7 +57,7 @@
<minidao.version>1.9.5</minidao.version> <minidao.version>1.9.5</minidao.version>
<!-- 积木报表--> <!-- 积木报表-->
<jimureport-spring-boot-starter.version>1.7.2-beta</jimureport-spring-boot-starter.version> <jimureport-spring-boot-starter.version>1.7.3</jimureport-spring-boot-starter.version>
<commons-io.version>2.11.0</commons-io.version> <commons-io.version>2.11.0</commons-io.version>
<commons.version>2.6</commons.version> <commons.version>2.6</commons.version>
<aliyun-java-sdk-dysmsapi.version>2.1.0</aliyun-java-sdk-dysmsapi.version> <aliyun-java-sdk-dysmsapi.version>2.1.0</aliyun-java-sdk-dysmsapi.version>