Browse Source

Merge pull request #2684 in CORE/base-third from release/10.0 to bugfix/10.0

* commit '955a412386150b67bb0866b7a00ca604a70f4c2e':
  DEC-19255 fix 对之前主键丢失的客户表做npe处理
  DEC-19255 fix 对之前主键丢失的客户表做npe处理
bugfix/10.0
superman 3 years ago
parent
commit
8cb7c52ffd
  1. 4
      fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java

4
fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java

@ -362,7 +362,9 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
Set<Identifier> identifiers = getUniqueKeyIdentifiers(table); Set<Identifier> identifiers = getUniqueKeyIdentifiers(table);
if (tableInfo != null) { if (tableInfo != null) {
for (IndexInformation indexInfo : tableInfo.getIndexes()) { for (IndexInformation indexInfo : tableInfo.getIndexes()) {
if (!indexInfo.isUnique() || indexInfo.getIndexIdentifier().equals(tableInfo.getPrimaryKey().getPrimaryKeyIdentifier())) { PrimaryKeyInformation primaryKey = tableInfo.getPrimaryKey();
//主键不存在时npe处理
if (!indexInfo.isUnique() || (primaryKey != null && indexInfo.getIndexIdentifier().equals(primaryKey.getPrimaryKeyIdentifier()))) {
continue; continue;
} }
//如果旧的唯一键已经不存在, 则删除 //如果旧的唯一键已经不存在, 则删除

Loading…
Cancel
Save