use of org.jumpmind.db.alter.ModelComparator in project symmetric-ds by JumpMind.
the class AbstractDdlBuilder method alterDatabase.
/**
* Generates the DDL to modify an existing database so the schema matches
* the specified database schema by using drops, modifications and
* additions. Database-specific implementations can change aspect of this
* algorithm by redefining the individual methods that compromise it.
*/
public void alterDatabase(Database currentModel, Database desiredModel, StringBuilder ddl, IAlterDatabaseInterceptor... alterDatabaseInterceptors) {
currentModel = currentModel.copy();
mergeOrRemovePlatformTypes(currentModel, desiredModel);
ModelComparator comparator = new ModelComparator(databaseName, databaseInfo, caseSensitive);
List<IModelChange> detectedChanges = comparator.compare(currentModel, desiredModel);
if (alterDatabaseInterceptors != null) {
for (IAlterDatabaseInterceptor interceptor : alterDatabaseInterceptors) {
detectedChanges = interceptor.intercept(detectedChanges, currentModel, desiredModel);
}
}
processChanges(currentModel, desiredModel, detectedChanges, ddl);
}
use of org.jumpmind.db.alter.ModelComparator in project symmetric-ds by JumpMind.
the class AbstractDdlBuilder method isAlterDatabase.
public boolean isAlterDatabase(Database currentModel, Database desiredModel, IAlterDatabaseInterceptor... alterDatabaseInterceptors) {
ModelComparator comparator = new ModelComparator(databaseName, databaseInfo, caseSensitive);
List<IModelChange> detectedChanges = comparator.compare(currentModel, desiredModel);
if (alterDatabaseInterceptors != null) {
for (IAlterDatabaseInterceptor interceptor : alterDatabaseInterceptors) {
detectedChanges = interceptor.intercept(detectedChanges, currentModel, desiredModel);
}
}
return detectedChanges.size() > 0;
}
Aggregations