Search in sources :

Example 1 with OperationCriticalTransaction

use of com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction in project Plan by plan-player-analytics.

the class SQLDB method setupDatabase.

/**
 * Ensures connection functions correctly and all tables exist.
 * <p>
 * Updates to latest schema.
 */
private void setupDatabase() {
    executeTransaction(new OperationCriticalTransaction() {

        @Override
        protected void performOperations() {
            logger.info(locale.getString(PluginLang.DB_SCHEMA_PATCH));
        }
    });
    executeTransaction(new CreateTablesTransaction());
    for (Patch patch : patches()) {
        executeTransaction(patch);
    }
    executeTransaction(new OperationCriticalTransaction() {

        @Override
        protected void performOperations() {
            logger.info(locale.getString(PluginLang.DB_APPLIED_PATCHES));
            if (getState() == State.PATCHING)
                setState(State.OPEN);
        }
    });
    registerIndexCreationTask();
}
Also used : CreateTablesTransaction(com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction) RemoveIncorrectTebexPackageDataPatch(com.djrapitops.plan.storage.database.transactions.init.RemoveIncorrectTebexPackageDataPatch) OperationCriticalTransaction(com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction)

Aggregations

CreateTablesTransaction (com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction)1 OperationCriticalTransaction (com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction)1 RemoveIncorrectTebexPackageDataPatch (com.djrapitops.plan.storage.database.transactions.init.RemoveIncorrectTebexPackageDataPatch)1