use of org.dbflute.logic.jdbc.schemadiff.DfSchemaDiff in project dbflute-core by dbflute.
the class DfAlterCheckProcess method checkAlter.
// ===================================================================================
// AlterCheck Process
// ==================
public DfAlterCheckFinalInfo checkAlter() {
deleteAllNGMark();
deleteSchemaXml();
deleteCraftMeta();
final DfAlterCheckFinalInfo finalInfo = new DfAlterCheckFinalInfo();
// after AlterCheck, the database has altered schema
// so you can check your application on the environment
// to be next DB
replaceSchema(finalInfo);
if (finalInfo.isFailure()) {
return finalInfo;
}
serializeNextSchema();
// to be previous DB
rollbackSchema();
alterSchema(finalInfo);
if (finalInfo.isFailure()) {
return finalInfo;
}
serializePreviousSchema();
// to replace the result file
deleteAlterCheckResultDiff();
final DfSchemaDiff schemaDiff = schemaDiff();
if (schemaDiff.hasDiff()) {
processDifference(finalInfo, schemaDiff);
} else {
processSuccess(finalInfo);
deleteAlterCheckMark();
deleteCraftMeta();
}
deleteSubmittedDraftFile(finalInfo);
// not finally because of trace when abort
deleteSchemaXml();
return finalInfo;
}
use of org.dbflute.logic.jdbc.schemadiff.DfSchemaDiff in project dbflute-core by dbflute.
the class DfAlterCheckProcess method schemaDiff.
// ===================================================================================
// SchemaDiff
// ==========
protected DfSchemaDiff schemaDiff() {
_log.info("");
_log.info("+-----------------+");
_log.info("| |");
_log.info("| Schema Diff |");
_log.info("| |");
_log.info("+-----------------|");
final String previousXml = getMigrationAlterCheckPreviousSchemaXml();
final String nextXml = getMigrationAlterCheckNextSchemaXml();
final DfSchemaDiff schemaDiff = DfSchemaDiff.createAsAlterCheck(previousXml, nextXml);
schemaDiff.enableCraftDiff(getMigrationAlterCheckCraftMetaDir());
schemaDiff.loadPreviousSchema();
schemaDiff.loadNextSchema();
schemaDiff.analyzeDiff();
return schemaDiff;
}
use of org.dbflute.logic.jdbc.schemadiff.DfSchemaDiff in project dbflute-core by dbflute.
the class DfFirstDateAgent method getTableFirstDateMap.
protected Map<String, Date> getTableFirstDateMap() {
// case insensitive (not flexible because of historical changes)
if (_tableFirstDateMap != null) {
return _tableFirstDateMap;
}
final Map<String, Date> tableFirstDateMap = StringKeyMap.createAsCaseInsensitiveOrdered();
final List<DfSchemaDiff> schemaDiffList = prepareSchemaDiffList();
for (DfSchemaDiff schemaDiff : schemaDiffList) {
List<DfTableDiff> tableDiffList = schemaDiff.getAddedTableDiffList();
for (DfTableDiff tableDiff : tableDiffList) {
final String tableName = tableDiff.getTableName();
tableFirstDateMap.put(tableName, schemaDiff.getNativeDiffDate());
}
}
_tableFirstDateMap = tableFirstDateMap;
return _tableFirstDateMap;
}
Aggregations