use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.
the class DfSequenceExtractorPostgreSQL method buildMetaSelectSql.
protected String buildMetaSelectSql() {
final String schemaCondition;
if (!_unifiedSchemaList.isEmpty()) {
final StringBuilder sb = new StringBuilder();
for (UnifiedSchema unifiedSchema : _unifiedSchemaList) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append("'").append(unifiedSchema.getPureSchema()).append("'");
}
schemaCondition = sb.toString();
} else {
schemaCondition = "'public'";
}
// and sequences cannot show only connected catalog, maybe...
return "select * from information_schema.sequences where sequence_schema in (" + schemaCondition + ")";
}
use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.
the class DfSequenceExtractorDB2 method buildMetaSelectSql.
protected String buildMetaSelectSql() {
final String schemaCondition;
if (!_unifiedSchemaList.isEmpty()) {
final StringBuilder sb = new StringBuilder();
for (UnifiedSchema unifiedSchema : _unifiedSchemaList) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append("'").append(unifiedSchema.getPureSchema()).append("'");
}
schemaCondition = sb.toString();
} else {
return null;
}
// the table 'SEQUENCES' on DB2 does not have catalog of sequence
return "select * from SYSCAT.SEQUENCES where SEQSCHEMA in (" + schemaCondition + ")";
}
use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.
the class DfCreateSchemaProcess method initializeSchemaAdditionalDrop.
protected boolean initializeSchemaAdditionalDrop() {
final List<Map<String, Object>> additionalDropMapList = getReplaceSchemaProperties().getAdditionalDropMapList();
if (additionalDropMapList.isEmpty()) {
return false;
}
_log.info("");
_log.info("* * * * * * * * * * * * * * * * * * * *");
_log.info("* *");
_log.info("* Initialize Schema (Additional Drop) *");
_log.info("* *");
_log.info("* * * * * * * * * * * * * * * * * * * *");
if (_lazyConnection) {
_log.info("*Passed because it's a lazy connection");
return false;
}
boolean initialized = false;
for (Map<String, Object> additionalDropMap : additionalDropMapList) {
final UnifiedSchema dropSchema = getReplaceSchemaProperties().getAdditionalDropSchema(additionalDropMap);
final String dropUrl = getReplaceSchemaProperties().getAdditionalDropUrl(additionalDropMap);
final StringBuilder logSb = new StringBuilder();
if (dropSchema.hasSchema()) {
logSb.append("[").append(dropSchema.getLoggingSchema()).append("]");
if (dropUrl != null && dropUrl.trim().length() > 0) {
logSb.append(": ").append(dropUrl);
}
} else {
if (dropUrl != null && dropUrl.trim().length() > 0) {
logSb.append(dropUrl);
}
}
_log.info(logSb.toString());
final DfSchemaInitializer initializer = createSchemaInitializerAdditional(additionalDropMap);
if (initializer != null) {
initializer.initializeSchema();
initialized = true;
}
}
return initialized;
}
use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method createAsTakeAssert.
public static DfTakeFinallyProcess createAsTakeAssert(String sqlRootDir, DataSource dataSource) {
final UnifiedSchema mainSchema = getDatabaseProperties().getDatabaseSchema();
final DfTakeFinallyProcess process = new DfTakeFinallyProcess(sqlRootDir, dataSource, mainSchema, null, null);
return // take-assert is not only for test data (if needs, option?)
process.suppressConventionalTakeAssert().suppressSequenceIncrement().skipIfNonAssetionSql().rollbackTransaction().continueIfAssetionFailure();
}
use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method createAsAlterSchema.
public static DfTakeFinallyProcess createAsAlterSchema(final String sqlRootDir, DataSource dataSource) {
final UnifiedSchema mainSchema = getDatabaseProperties().getDatabaseSchema();
final DfTakeFinallySqlFileProvider provider = new DfTakeFinallySqlFileProvider() {
public List<File> provide() {
return getReplaceSchemaProperties().getMigrationAlterTakeFinallySqlFileList(sqlRootDir);
}
};
final DfTakeFinallyProcess process = new DfTakeFinallyProcess(sqlRootDir, dataSource, mainSchema, provider, null);
// but increment sequences for development after AlterCheck
return process.suppressConventionalTakeAssert().restrictIfNonAssetionSql().rollbackTransaction();
}
Aggregations