fix: Throw ex on DDL fails

This commit is contained in:
devezhao-mbp 2019-12-21 22:38:47 +08:00
parent d77e0318a2
commit 452d0a034f
2 changed files with 4 additions and 4 deletions

View file

@ -94,7 +94,7 @@ public class Installer implements InstallAfter {
}
dbProps.putAll(cacheProps);
}
try {
FileUtils.deleteQuietly(dest);
try (OutputStream os = new FileOutputStream(dest)) {

View file

@ -157,15 +157,15 @@ public class Entity2Schema extends Field2Schema {
} catch (Throwable ex) {
LOG.error(null, ex);
Application.getCommonService().delete(tempMetaId.toArray(new ID[0]));
return null;
throw new ModifiyMetadataException("元数据初始化失败 : " + ex.getLocalizedMessage());
}
boolean schemaReady = schema2Database(tempEntity);
if (!schemaReady) {
Application.getCommonService().delete(tempMetaId.toArray(new ID[0]));
return null;
throw new ModifiyMetadataException("无法创建表到数据库");
}
Application.getMetadataFactory().refresh(false);
return entityName;
}