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