Skip to content

Commit 16f952f

Browse files
committed
merge
2 parents b62b421 + 2728259 commit 16f952f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

chat2db-server/chat2db-plugins/chat2db-mysql/src/main/java/ai/chat2db/plugin/mysql/builder/MysqlSqlBuilder.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ public String buildModifyTaleSql(Table oldTable, Table newTable) {
9595
script.append("\t").append(mysqlIndexTypeEnum.buildModifyIndex(tableIndex)).append(",\n");
9696
}
9797
}
98-
99-
script = new StringBuilder(script.substring(0, script.length() - 2));
100-
script.append(";");
98+
if(script.length()>2) {
99+
script = new StringBuilder(script.substring(0, script.length() - 2));
100+
script.append(";");
101+
}
101102

102103
return script.toString();
103104
}

chat2db-server/chat2db-plugins/chat2db-oracle/src/main/java/ai/chat2db/plugin/oracle/builder/OracleSqlBuilder.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public String buildModifyTaleSql(Table oldTable, Table newTable) {
6767

6868
if (!StringUtils.equalsIgnoreCase(oldTable.getName(), newTable.getName())) {
6969
script.append("ALTER TABLE "). append("\"").append(oldTable.getSchemaName()).append("\".\"").append(oldTable.getName()).append("\"");
70-
script.append(" ").append("RENAME TO ").append("\"").append(newTable.getName()).append("\"").append(";");
70+
script.append(" ").append("RENAME TO ").append("\"").append(newTable.getName()).append("\"").append(";\n");
7171
}
7272
if (!StringUtils.equalsIgnoreCase(oldTable.getComment(), newTable.getComment())) {
73-
script.append("\n").append(buildTableComment(newTable)).append(";");
73+
script.append("").append(buildTableComment(newTable)).append(";\n");
7474
}
7575

7676

@@ -92,9 +92,10 @@ public String buildModifyTaleSql(Table oldTable, Table newTable) {
9292
script.append("\t").append(mysqlIndexTypeEnum.buildModifyIndex(tableIndex)).append(";\n");
9393
}
9494
}
95-
96-
script = new StringBuilder(script.substring(0, script.length() - 2));
97-
script.append(";");
95+
if(script.length()>2) {
96+
script = new StringBuilder(script.substring(0, script.length() - 2));
97+
script.append(";");
98+
}
9899

99100
return script.toString();
100101
}

0 commit comments

Comments
 (0)