mongodb初始化注销
This commit is contained in:
parent
43f01064ee
commit
2eaafe65d5
|
@ -18,7 +18,7 @@ spring:
|
|||
# username: hzya
|
||||
flyway:
|
||||
# 启动flyway migration, 默认为true
|
||||
enabled: false
|
||||
enabled: true
|
||||
datasource:
|
||||
dynamic:
|
||||
druid:
|
||||
|
|
|
@ -6,6 +6,8 @@ server:
|
|||
tomcat:
|
||||
uri-encoding: utf-8
|
||||
spring:
|
||||
autoconfigure:
|
||||
exclude: org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
|
||||
flyway:
|
||||
# 启动flyway migration, 默认为true
|
||||
enabled: true
|
||||
|
|
|
@ -48,29 +48,31 @@ public class FlywayConfig {
|
|||
|
||||
@PostConstruct
|
||||
public void migrateOrder() {
|
||||
String pwd = AESUtil.decrypt(password);
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
DataSource dsDatasource = null;
|
||||
if("false".equals(enabled)){
|
||||
String pwd = AESUtil.decrypt(password);
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
DataSource dsDatasource = null;
|
||||
|
||||
dsDatasource = ds.getDataSource("master");
|
||||
// 将路径转换
|
||||
Flyway flyway = Flyway.configure()
|
||||
//.dataSource(url,username,pwd)
|
||||
.dataSource(dsDatasource)
|
||||
.cleanDisabled(cleanDisabled)
|
||||
.locations(locations)
|
||||
.table(table)
|
||||
.encoding("utf-8")
|
||||
.outOfOrder(true)
|
||||
.baselineOnMigrate(true)
|
||||
.validateOnMigrate(baselineOnMigrate)
|
||||
.validateOnMigrate(validateOnMigrat)
|
||||
.sqlMigrationPrefix(sqlMigrationPrefix)
|
||||
.sqlMigrationSeparator(sqlMigrationSeparator)
|
||||
.sqlMigrationSuffixes(sqlMigrationSuffixes)
|
||||
.placeholderReplacement(placeholderReplacement)
|
||||
.load();
|
||||
flyway.migrate();
|
||||
// 将路径转换
|
||||
Flyway flyway = Flyway.configure()
|
||||
//.dataSource(url,username,pwd)
|
||||
.dataSource(dsDatasource)
|
||||
.cleanDisabled(cleanDisabled)
|
||||
.locations(locations)
|
||||
.table(table)
|
||||
.encoding("utf-8")
|
||||
.outOfOrder(true)
|
||||
.baselineOnMigrate(true)
|
||||
.validateOnMigrate(baselineOnMigrate)
|
||||
.validateOnMigrate(validateOnMigrat)
|
||||
.sqlMigrationPrefix(sqlMigrationPrefix)
|
||||
.sqlMigrationSeparator(sqlMigrationSeparator)
|
||||
.sqlMigrationSuffixes(sqlMigrationSuffixes)
|
||||
.placeholderReplacement(placeholderReplacement)
|
||||
.load();
|
||||
flyway.migrate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue