use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.
the class DBPreparer method prepareMySQL.
public Optional<Database> prepareMySQL() {
PlanConfig config = dependencies.config();
Optional<String> formattedDB = setUpMySQLSettings(config);
if (formattedDB.isPresent()) {
String formattedDatabase = formattedDB.get();
SQLDB mysql = prepareDBByName(DBType.MYSQL.getName());
mysql.executeTransaction(new Transaction() {
@Override
protected void performOperations() {
execute("DROP DATABASE " + formattedDatabase);
execute("CREATE DATABASE " + formattedDatabase);
execute("USE " + formattedDatabase);
}
});
return Optional.of(mysql);
}
return Optional.empty();
}
Aggregations