add - 新增升级脚本的执行逻辑, 确保以后的版本迭代只需要保证脚本执行正常即可.

This commit is contained in:
wangli 2024-01-22 17:55:25 +08:00
parent 14424f34a3
commit cf3cc08cd8
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ insert into ext_ax_hi_taskinst (proc_inst_id, task_id, task_definition_key, stat
select PROC_INST_ID_, ID_, TASK_DEF_KEY_, 'PROCESSING', ifnull(ASSIGNEE_, '') as ASSIGNEE_ select PROC_INST_ID_, ID_, TASK_DEF_KEY_, 'PROCESSING', ifnull(ASSIGNEE_, '') as ASSIGNEE_
from act_hi_taskinst from act_hi_taskinst
where END_TIME_ is null where END_TIME_ is null
and ID_ not in (select distinct task_id from ext_ax_hi_taskinst) and ID_ not in (select distinct task_id from ext_ax_hi_taskinst);

View File

@ -58,9 +58,9 @@ public class VersionUpgradeInitializer implements ApplicationRunner {
int current = Integer.parseInt(currentVersion.replace(".", "")); int current = Integer.parseInt(currentVersion.replace(".", ""));
if (upgradeVersion > current) { if (upgradeVersion > current) {
newVersions.add(upgradeVersion); newVersions.add(upgradeVersion);
log.debug("execute sql script: {}", i);
try { try {
executeSqlScript(i); executeSqlScript(i);
log.debug("execute sql script: {}", i);
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(LogUtil.ErrorType.ERROR_SQL, "升级服务数据库版本发生异常,文件: {}, 异常信息: {}", i, e.getMessage()); LogUtil.error(LogUtil.ErrorType.ERROR_SQL, "升级服务数据库版本发生异常,文件: {}, 异常信息: {}", i, e.getMessage());
result.compareAndSet(true, false); result.compareAndSet(true, false);
@ -113,6 +113,7 @@ public class VersionUpgradeInitializer implements ApplicationRunner {
// Split SQL statements and execute each one // Split SQL statements and execute each one
String[] sqlStatements = scriptBuilder.toString().split(";"); String[] sqlStatements = scriptBuilder.toString().split(";");
for (String sql : sqlStatements) { for (String sql : sqlStatements) {
log.info("sql: {}", sql);
jdbcTemplate.execute(sql); jdbcTemplate.execute(sql);
} }
} catch (IOException e) { } catch (IOException e) {