diff --git a/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/config/flyway/FlywayConfig.java b/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/config/flyway/FlywayConfig.java index adc8e86d..c16f7f42 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/config/flyway/FlywayConfig.java +++ b/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/config/flyway/FlywayConfig.java @@ -2,8 +2,6 @@ package org.jeecg.config.flyway; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; 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.Value; @@ -96,41 +94,41 @@ public class FlywayConfig { @Value("${spring.flyway.clean-disabled:true}") private Boolean cleanDisabled; - @Bean - public void migrate() { - if(!enabled){ - return; - } - - DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource; - Map dataSources = ds.getDataSources(); - dataSources.forEach((k, v) -> { - if("master".equals(k)){ - String databaseType = environment.getProperty("spring.datasource.dynamic.datasource." + k + ".url"); - if (databaseType != null && databaseType.contains("mysql")) { - try { - Flyway flyway = Flyway.configure() - .dataSource(v) - .locations(locations) - .encoding(encoding) - .sqlMigrationPrefix(sqlMigrationPrefix) - .sqlMigrationSeparator(sqlMigrationSeparator) - .placeholderPrefix(placeholderPrefix) - .placeholderSuffix(placeholderSuffix) - .sqlMigrationSuffixes(sqlMigrationSuffixes) - .validateOnMigrate(validateOnMigrate) - .baselineOnMigrate(baselineOnMigrate) - .cleanDisabled(cleanDisabled) - .load(); - flyway.migrate(); - log.info("【升级提示】平台集成了MySQL库的Flyway,数据库版本自动升级! "); - } catch (FlywayException e) { - log.error("【升级提示】flyway执行sql脚本失败", e); - } - } else { - log.warn("【升级提示】平台只集成了MySQL库的Flyway,实现了数据库版本自动升级! 其他类型的数据库,您可以考虑手工升级~"); - } - } - }); - } +// @Bean +// public void migrate() { +// if(!enabled){ +// return; +// } +// +// DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource; +// Map dataSources = ds.getDataSources(); +// dataSources.forEach((k, v) -> { +// if("master".equals(k)){ +// String databaseType = environment.getProperty("spring.datasource.dynamic.datasource." + k + ".url"); +// if (databaseType != null && databaseType.contains("mysql")) { +// try { +// Flyway flyway = Flyway.configure() +// .dataSource(v) +// .locations(locations) +// .encoding(encoding) +// .sqlMigrationPrefix(sqlMigrationPrefix) +// .sqlMigrationSeparator(sqlMigrationSeparator) +// .placeholderPrefix(placeholderPrefix) +// .placeholderSuffix(placeholderSuffix) +// .sqlMigrationSuffixes(sqlMigrationSuffixes) +// .validateOnMigrate(validateOnMigrate) +// .baselineOnMigrate(baselineOnMigrate) +// .cleanDisabled(cleanDisabled) +// .load(); +// flyway.migrate(); +// log.info("【升级提示】平台集成了MySQL库的Flyway,数据库版本自动升级! "); +// } catch (FlywayException e) { +// log.error("【升级提示】flyway执行sql脚本失败", e); +// } +// } else { +// log.warn("【升级提示】平台只集成了MySQL库的Flyway,实现了数据库版本自动升级! 其他类型的数据库,您可以考虑手工升级~"); +// } +// } +// }); +// } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index e0bc3d6e..478f0c90 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.9.5 - 1.7.2-beta + 1.7.3 2.11.0 2.6 2.1.0