mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-06 10:27:42 +02:00
Removed SQLDB#createTables
This commit is contained in:
parent
73c9f71166
commit
0fae44cc80
@ -213,7 +213,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
*/
|
||||
private void setupDatabase() throws DBInitException {
|
||||
try {
|
||||
createTables();
|
||||
executeTransaction(new CreateTablesTransaction());
|
||||
registerIndexCreationTask();
|
||||
registerPatchTask();
|
||||
} catch (DBOpException | IllegalArgumentException e) {
|
||||
@ -244,16 +244,6 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tables that contain data.
|
||||
* <p>
|
||||
* Updates table columns to latest schema.
|
||||
*/
|
||||
@Deprecated
|
||||
void createTables() throws DBInitException {
|
||||
executeTransaction(new CreateTablesTransaction());
|
||||
}
|
||||
|
||||
public abstract void setupDataSource() throws DBInitException;
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +123,7 @@ public abstract class CommonDBTest {
|
||||
dropTable("plan_users");
|
||||
}
|
||||
}.apply();
|
||||
db.createTables();
|
||||
db.executeTransaction(new CreateTablesTransaction());
|
||||
db.executeTransaction(new RemoveEverythingTransaction());
|
||||
ServerTable serverTable = db.getServerTable();
|
||||
serverTable.saveCurrentServerInfo(new Server(-1, serverUUID, "ServerName", "", 20));
|
||||
|
@ -19,7 +19,9 @@ package com.djrapitops.plan.db;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
||||
import com.djrapitops.plan.db.access.transactions.CreateTablesTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.RemoveEverythingTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||
import com.djrapitops.plan.db.tasks.PatchTask;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
@ -81,22 +83,27 @@ public class DBPatchH2RegressionTest extends DBPatchRegressionTest {
|
||||
underTest.setupDataSource();
|
||||
|
||||
// Initialize database with the old table schema
|
||||
underTest.execute(serverTable);
|
||||
underTest.execute(usersTable);
|
||||
underTest.execute(userInfoTable);
|
||||
underTest.execute(geoInfoTable);
|
||||
underTest.execute(nicknameTable);
|
||||
underTest.execute(sessionsTable);
|
||||
underTest.execute(killsTable);
|
||||
underTest.execute(pingTable);
|
||||
underTest.execute(commandUseTable);
|
||||
underTest.execute(tpsTable);
|
||||
underTest.execute(worldsTable);
|
||||
underTest.execute(worldTimesTable);
|
||||
underTest.execute(securityTable);
|
||||
underTest.execute(transferTable);
|
||||
underTest.executeTransaction(new Transaction() {
|
||||
@Override
|
||||
protected void performOperations() {
|
||||
execute(serverTable);
|
||||
execute(usersTable);
|
||||
execute(userInfoTable);
|
||||
execute(geoInfoTable);
|
||||
execute(nicknameTable);
|
||||
execute(sessionsTable);
|
||||
execute(killsTable);
|
||||
execute(pingTable);
|
||||
execute(commandUseTable);
|
||||
execute(tpsTable);
|
||||
execute(worldsTable);
|
||||
execute(worldTimesTable);
|
||||
execute(securityTable);
|
||||
execute(transferTable);
|
||||
}
|
||||
});
|
||||
|
||||
underTest.createTables();
|
||||
underTest.executeTransaction(new CreateTablesTransaction());
|
||||
|
||||
insertData(underTest);
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
||||
import com.djrapitops.plan.db.access.transactions.CreateTablesTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.RemoveEverythingTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||
import com.djrapitops.plan.db.tasks.PatchTask;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
@ -98,30 +100,40 @@ public class DBPatchMySQLRegressionTest extends DBPatchRegressionTest {
|
||||
dropAllTables();
|
||||
|
||||
// Initialize database with the old table schema
|
||||
underTest.execute(serverTable);
|
||||
underTest.execute(usersTable);
|
||||
underTest.execute(userInfoTable);
|
||||
underTest.execute(geoInfoTable);
|
||||
underTest.execute(nicknameTable);
|
||||
underTest.execute(sessionsTable);
|
||||
underTest.execute(killsTable);
|
||||
underTest.execute(pingTable);
|
||||
underTest.execute(commandUseTable);
|
||||
underTest.execute(tpsTable);
|
||||
underTest.execute(worldsTable);
|
||||
underTest.execute(worldTimesTable);
|
||||
underTest.execute(securityTable);
|
||||
underTest.execute(transferTable);
|
||||
underTest.executeTransaction(new Transaction() {
|
||||
@Override
|
||||
protected void performOperations() {
|
||||
execute(serverTable);
|
||||
execute(usersTable);
|
||||
execute(userInfoTable);
|
||||
execute(geoInfoTable);
|
||||
execute(nicknameTable);
|
||||
execute(sessionsTable);
|
||||
execute(killsTable);
|
||||
execute(pingTable);
|
||||
execute(commandUseTable);
|
||||
execute(tpsTable);
|
||||
execute(worldsTable);
|
||||
execute(worldTimesTable);
|
||||
execute(securityTable);
|
||||
execute(transferTable);
|
||||
}
|
||||
});
|
||||
|
||||
underTest.createTables();
|
||||
underTest.executeTransaction(new CreateTablesTransaction());
|
||||
|
||||
insertData(underTest);
|
||||
}
|
||||
|
||||
private void dropAllTables() {
|
||||
underTest.execute("DROP DATABASE Plan");
|
||||
underTest.execute("CREATE DATABASE Plan");
|
||||
underTest.execute("USE Plan");
|
||||
underTest.executeTransaction(new Transaction() {
|
||||
@Override
|
||||
protected void performOperations() {
|
||||
execute("DROP DATABASE Plan");
|
||||
execute("CREATE DATABASE Plan");
|
||||
execute("USE Plan");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -19,7 +19,9 @@ package com.djrapitops.plan.db;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
||||
import com.djrapitops.plan.db.access.transactions.CreateTablesTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.RemoveEverythingTransaction;
|
||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||
import com.djrapitops.plan.db.tasks.PatchTask;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
@ -74,22 +76,27 @@ public class DBPatchSQLiteRegressionTest extends DBPatchRegressionTest {
|
||||
underTest.setupDataSource();
|
||||
|
||||
// Initialize database with the old table schema
|
||||
underTest.execute(serverTable);
|
||||
underTest.execute(usersTable);
|
||||
underTest.execute(userInfoTable);
|
||||
underTest.execute(geoInfoTable);
|
||||
underTest.execute(nicknameTable);
|
||||
underTest.execute(sessionsTable);
|
||||
underTest.execute(killsTable);
|
||||
underTest.execute(pingTable);
|
||||
underTest.execute(commandUseTable);
|
||||
underTest.execute(tpsTable);
|
||||
underTest.execute(worldsTable);
|
||||
underTest.execute(worldTimesTable);
|
||||
underTest.execute(securityTable);
|
||||
underTest.execute(transferTable);
|
||||
underTest.executeTransaction(new Transaction() {
|
||||
@Override
|
||||
protected void performOperations() {
|
||||
execute(serverTable);
|
||||
execute(usersTable);
|
||||
execute(userInfoTable);
|
||||
execute(geoInfoTable);
|
||||
execute(nicknameTable);
|
||||
execute(sessionsTable);
|
||||
execute(killsTable);
|
||||
execute(pingTable);
|
||||
execute(commandUseTable);
|
||||
execute(tpsTable);
|
||||
execute(worldsTable);
|
||||
execute(worldTimesTable);
|
||||
execute(securityTable);
|
||||
execute(transferTable);
|
||||
}
|
||||
});
|
||||
|
||||
underTest.createTables();
|
||||
underTest.executeTransaction(new CreateTablesTransaction());
|
||||
|
||||
insertData(underTest);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user