add - 新增升级脚本的执行逻辑, 确保以后的版本迭代只需要保证脚本执行正常即可.
This commit is contained in:
parent
6cc59e2d6f
commit
bc09174f4a
@ -12,6 +12,7 @@ import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@ -115,8 +116,10 @@ public class VersionUpgradeInitializer implements ApplicationRunner {
|
||||
// Split SQL statements and execute each one
|
||||
String[] sqlStatements = scriptBuilder.toString().split(";");
|
||||
for (String sql : sqlStatements) {
|
||||
log.info("sql: {}", sql);
|
||||
jdbcTemplate.execute(sql);
|
||||
if (StringUtils.hasLength(sql)) {
|
||||
log.info("sql: {}", sql);
|
||||
jdbcTemplate.execute(sql);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Handle IOException
|
||||
|
||||
Loading…
Reference in New Issue
Block a user