diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemoveEverythingTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemoveEverythingTransaction.java index 2230b7562..371731ad5 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemoveEverythingTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemoveEverythingTransaction.java @@ -48,6 +48,8 @@ public class RemoveEverythingTransaction extends Transaction { clearTable(ServerTable.TABLE_NAME); clearTable(ExtensionPlayerValueTable.TABLE_NAME); clearTable(ExtensionServerValueTable.TABLE_NAME); + clearTable(ExtensionPlayerGroupsTable.TABLE_NAME); + clearTable(ExtensionGroupsTable.TABLE_NAME); clearTable(ExtensionProviderTable.TABLE_NAME); clearTable(ExtensionPlayerTableValueTable.TABLE_NAME); clearTable(ExtensionServerTableValueTable.TABLE_NAME); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemovePlayerTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemovePlayerTransaction.java index f6f9c9c18..925cb0855 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemovePlayerTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/commands/RemovePlayerTransaction.java @@ -57,6 +57,10 @@ public class RemovePlayerTransaction extends Transaction { deleteFromTable(PingTable.TABLE_NAME); deleteFromTable(UserInfoTable.TABLE_NAME); deleteFromTable(UsersTable.TABLE_NAME); + + deleteFromTable(ExtensionPlayerTableValueTable.TABLE_NAME); + deleteFromTable(ExtensionPlayerValueTable.TABLE_NAME); + deleteFromTable(ExtensionPlayerGroupsTable.TABLE_NAME); } private void deleteWebUser(String username) { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/init/CreateTablesTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/init/CreateTablesTransaction.java index 35fd01ee1..87b7c09d7 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/init/CreateTablesTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/access/transactions/init/CreateTablesTransaction.java @@ -56,5 +56,7 @@ public class CreateTablesTransaction extends OperationCriticalTransaction { execute(ExtensionTableProviderTable.createTableSQL(dbType)); execute(ExtensionPlayerTableValueTable.createTableSQL(dbType)); execute(ExtensionServerTableValueTable.createTableSQL(dbType)); + execute(ExtensionGroupsTable.createTableSQL(dbType)); + execute(ExtensionPlayerGroupsTable.createTableSQL(dbType)); } } \ No newline at end of file diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionGroupsTable.java b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionGroupsTable.java new file mode 100644 index 000000000..1b8a48ab3 --- /dev/null +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionGroupsTable.java @@ -0,0 +1,49 @@ +/* + * This file is part of Player Analytics (Plan). + * + * Plan is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License v3 as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Plan is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Plan. If not, see . + */ +package com.djrapitops.plan.db.sql.tables; + +import com.djrapitops.plan.db.DBType; +import com.djrapitops.plan.db.sql.parsing.CreateTableParser; +import com.djrapitops.plan.db.sql.parsing.Sql; + +/** + * Table information about 'plan_extension_groups'. + * + * @author Rsl1122 + */ +public class ExtensionGroupsTable { + + public static final String TABLE_NAME = "plan_extension_groups"; + + public static final String ID = "id"; + public static final String PROVIDER_ID = "provider_id"; + public static final String GROUP_NAME = "group_name"; + + private ExtensionGroupsTable() { + /* Static information class */ + } + + public static String createTableSQL(DBType dbType) { + return CreateTableParser.create(TABLE_NAME, dbType) + .column(ID, Sql.INT).primaryKey() + .column(GROUP_NAME, Sql.varchar(50)) + .column(PROVIDER_ID, Sql.INT).notNull() + .foreignKey(PROVIDER_ID, ExtensionProviderTable.TABLE_NAME, ExtensionProviderTable.ID) + .build(); + } + +} \ No newline at end of file diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionPlayerGroupsTable.java b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionPlayerGroupsTable.java new file mode 100644 index 000000000..2a7a2d874 --- /dev/null +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ExtensionPlayerGroupsTable.java @@ -0,0 +1,49 @@ +/* + * This file is part of Player Analytics (Plan). + * + * Plan is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License v3 as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Plan is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Plan. If not, see . + */ +package com.djrapitops.plan.db.sql.tables; + +import com.djrapitops.plan.db.DBType; +import com.djrapitops.plan.db.sql.parsing.CreateTableParser; +import com.djrapitops.plan.db.sql.parsing.Sql; + +/** + * Table information about 'plan_extension_player_groups'. + * + * @author Rsl1122 + */ +public class ExtensionPlayerGroupsTable { + + public static final String TABLE_NAME = "plan_extension_player_groups"; + + public static final String ID = "id"; + public static final String GROUP_ID = "group_id"; + public static final String USER_UUID = "uuid"; + + private ExtensionPlayerGroupsTable() { + /* Static information class */ + } + + public static String createTableSQL(DBType dbType) { + return CreateTableParser.create(TABLE_NAME, dbType) + .column(ID, Sql.INT).primaryKey() + .column(GROUP_ID, Sql.INT).notNull() + .column(USER_UUID, Sql.varchar(36)).notNull() + .foreignKey(GROUP_ID, ExtensionGroupsTable.TABLE_NAME, ExtensionGroupsTable.ID) + .build(); + } + +} \ No newline at end of file