use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer in project dbflute-core by dbflute.
the class DfLReverseSchemaMetaProvider method prepareDatabase.
// ===================================================================================
// Prepare
// =======
public Database prepareDatabase() {
final String schemaXml = getReverseSchemaXml();
final DfSchemaXmlSerializer serializer = createSchemaXmlSerializer(schemaXml);
serializer.serialize();
final DfSchemaXmlReader reader = createSchemaXmlReader(schemaXml);
final AppData appData = reader.read();
return appData.getDatabase();
}
use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer in project dbflute-core by dbflute.
the class DfAlterCheckProcess method serializeNextSchema.
// ===================================================================================
// Serialize Schema
// ================
protected void serializeNextSchema() {
final String nextXml = getMigrationAlterCheckNextSchemaXml();
final DfCraftDiffAssertDirection direction = DfCraftDiffAssertDirection.DIRECT_NEXT;
final DfSchemaXmlSerializer serializer = createSchemaXmlSerializer(nextXml, direction);
serializer.serialize();
}
use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer in project dbflute-core by dbflute.
the class DfAlterCheckProcess method createSchemaXmlSerializer.
protected DfSchemaXmlSerializer createSchemaXmlSerializer(String schemaXml, DfCraftDiffAssertDirection direction) {
// no use history here (use SchemaDiff directly later)
final String historyFile = null;
final DfSchemaXmlSerializer serializer = DfSchemaXmlSerializer.createAsManage(_dataSource, schemaXml, historyFile);
final String craftMetaDir = getMigrationAlterCheckCraftMetaDir();
serializer.enableCraftDiff(_dataSource, craftMetaDir, direction);
return serializer;
}
use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer in project dbflute-core by dbflute.
the class DfSPolicyInRepsChecker method checkSchemaPolicyInRepsIfNeeds.
// ===================================================================================
// Check
// =====
public boolean checkSchemaPolicyInRepsIfNeeds() {
// returns check executed or not
final DfReplaceSchemaProperties repsProp = getReplaceSchemaProperties();
if (!repsProp.isCheckSchemaPolicyInReps()) {
return false;
}
final DfSchemaPolicyProperties policyProp = getSchemaPolicyProperties();
if (!policyProp.hasPolicy()) {
return false;
}
_log.info("");
_log.info("* * * * * * * * * * * *");
_log.info("* *");
_log.info("* Schema Policy *");
_log.info("* *");
_log.info("* * * * * * * * * * * *");
final String schemaXml = repsProp.getSchemaPolicyInRepsSchemaXml();
deleteTemporarySchemaXmlIfExists(schemaXml);
final DfSchemaXmlSerializer serializer = createSchemaXmlSerializer(schemaXml);
serializer.serialize();
try {
final DfSchemaXmlReader reader = createSchemaXmlReader(schemaXml);
final AppData appData = reader.read();
final Database database = appData.getDatabase();
// for e.g. "then classification"
initializeSupplementaryMetaData(database);
final DfSPolicyChecker checker = createChecker(policyProp, database);
final DfSPolicyResult policyResult = checker.checkPolicyIfNeeds();
if (policyResult == null) {
// no way already checked, just in case
return false;
}
// immediately handles violation (may be throw)
policyResult.ending();
} finally {
deleteTemporarySchemaXmlIfExists(schemaXml);
}
return true;
}
use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer in project dbflute-core by dbflute.
the class DfSchemaSyncChecker method serializeTargetSchema.
protected DfSchemaXmlSerializer serializeTargetSchema() {
// as previous
final DataSource targetDs = prepareTargetDataSource();
final DfSchemaXmlSerializer targetSerializer = createTargetSerializer(targetDs);
// same reason as main schema
targetSerializer.suppressSchemaDiff();
targetSerializer.serialize();
return targetSerializer;
}
Aggregations