Search in sources :

Example 1 with DfSchemaInitializer

use of org.dbflute.logic.replaceschema.schemainitializer.DfSchemaInitializer 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;
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap) DfSchemaInitializer(org.dbflute.logic.replaceschema.schemainitializer.DfSchemaInitializer)

Example 2 with DfSchemaInitializer

use of org.dbflute.logic.replaceschema.schemainitializer.DfSchemaInitializer in project dbflute-core by dbflute.

the class DfCreateSchemaProcess method initializeSchemaMainDrop.

protected boolean initializeSchemaMainDrop() {
    _log.info("");
    _log.info("* * * * * * * * * * *");
    _log.info("*                   *");
    _log.info("* Initialize Schema *");
    _log.info("*                   *");
    _log.info("* * * * * * * * * * *");
    if (_lazyConnection) {
        _log.info("*Passed because it's a lazy connection");
        _skippedInitializeSchema = true;
        return false;
    }
    final DfSchemaInitializer initializer = createSchemaInitializer(InitializeType.MAIN);
    boolean initialized = false;
    if (initializer != null) {
        initializer.initializeSchema();
        initialized = true;
    }
    return initialized;
}
Also used : DfSchemaInitializer(org.dbflute.logic.replaceschema.schemainitializer.DfSchemaInitializer)

Aggregations

DfSchemaInitializer (org.dbflute.logic.replaceschema.schemainitializer.DfSchemaInitializer)2 Map (java.util.Map)1 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)1 StringKeyMap (org.dbflute.helper.StringKeyMap)1