use of com.developmentontheedge.be5.metadata.model.DdlElement in project be5 by DevelopmentOnTheEdge.
the class TableDef method getDiffDdl.
@Override
public String getDiffDdl(DdlElement other, SqlExecutor sql) throws ExtendedSqlException {
if (other == null)
return getCreateDdl();
if (!(other instanceof TableDef))
return other.getDropDdl() + getCreateDdl();
TableDef def = (TableDef) ((TableDef) other).clone(other.getOrigin(), other.getName());
Rdbms dbms = getProject().getDatabaseSystem();
DbmsTypeManager typeManager = dbms.getTypeManager();
String columnsDiff = getColumnsDiff(def, typeManager, false, sql);
if (// no columns match
columnsDiff == null)
return getDdl();
String indicesDiff = getIndicesDiff(def, dbms, typeManager);
if (columnsDiff.isEmpty()) {
return indicesDiff;
}
if (getModule().getName().equals(getProject().getProjectOrigin()) && sql != null && sql.isEmpty(getEntityName())) {
return def.getDropDdl() + getCreateDdl();
}
return columnsDiff + indicesDiff;
}
Aggregations