Database db1 = config.getMetaData1();
Database db2 = config.getMetaData2();
LOGGER.info("Comparing databases...");
SchemaComparator comparator = new SchemaComparator(config);
SchemaChange schemaChange = comparator.compare(db1, db2);
LOGGER.info("Database comparison finished");
// print out all changes
System.out.println("All Changes:");
System.out.println(schemaChange);
// process changes
System.out.println("Processing changes...");
for (SchemaChangeProcessor processor : processors)
processor.process(schemaChange);
// run db sanity checks for the restrictions
CachingDBImporter.updateCacheFile(db2); // save cache file for DB Sanity
int errorCount = 0;
if (checkingData && schemaChange.countChanges() > 0)
errorCount = checkRestrictions(schemaChange);
createReport(schemaChange);
// the report modules are likely to have fetched additional detail data,
// so we should make a cache update at the very end
CachingDBImporter.updateCacheFile(db1);
CachingDBImporter.updateCacheFile(db2);
// print profile if requested
if (Profiling.isEnabled())
CounterRepository.getInstance().printSummary();
// create result code
if (schemaChange.countChanges() == 0)
return MadResult.UNCHANGED;
return (errorCount > 0 ? MadResult.ERROR : MadResult.CHANGED);
}