Skip to content

Commit

Permalink
1.5.8 修复:表无主键时更新表结构sql错误
Browse files Browse the repository at this point in the history
优化:查询列表时,当数量为0时就不在查询列表了,直接返回
  • Loading branch information
785160953 committed Jan 30, 2019
1 parent c643632 commit d2c275e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/xin/xihc/jba/db/DB_MySql_Opera.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ public void updateTable(TableProperties tbl) {
String oldPrimary = dbColumnList.stream().filter(x -> x.primary()).map(ColumnProperties::colName).sorted().collect(Collectors.joining(","));
String newPrimary = tbl.getColumns().values().stream().filter(x -> x.primary()).map(ColumnProperties::colName).sorted().collect(Collectors.joining(","));
if (!newPrimary.equals(oldPrimary)) {
sqls.add("DROP PRIMARY KEY");
if (CommonUtil.isNotNullEmpty(oldPrimary)) {
sqls.add("DROP PRIMARY KEY");
}
if (CommonUtil.isNotNullEmpty(newPrimary)) {
sqls.add("ADD PRIMARY KEY (" + newPrimary + ")");
}
Expand Down

0 comments on commit d2c275e

Please sign in to comment.