Added new tables for extension groups

This commit is contained in:
Rsl1122 2019-08-26 15:51:02 +03:00
parent dacc089bb7
commit 49f7286923
5 changed files with 106 additions and 0 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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));
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}
}