Database indexing & table cleanup

This commit is contained in:
Kyep
2020-10-20 13:20:17 -07:00
parent e84e8ad0fa
commit b08d5ed03d
5 changed files with 87 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
#Updating the SQL from version 13 to version 14. -Kyet
# Add new tables used by backend tooling
CREATE TABLE `ip2group`
(
`ip` varchar (18) NOT NULL,
`date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,
`groupstr` varchar (32) NOT NULL DEFAULT '',
PRIMARY KEY (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `ip2group` ADD INDEX(`groupstr`);
# Delete tables that already exist but are not used anywhere in either game or backend code
DROP TABLE IF EXISTS `erro_privacy`;
DROP TABLE IF EXISTS `population`;
# Add search indexes to make the most common DB queries faster
ALTER TABLE `admin` ADD INDEX(`ckey`);
ALTER TABLE `admin_log` ADD INDEX(`adminckey`);
ALTER TABLE `connection_log` ADD INDEX(`ckey`);
ALTER TABLE `connection_log` ADD INDEX(`ip`);
ALTER TABLE `connection_log` ADD INDEX(`computerid`);
ALTER TABLE `customuseritems` ADD INDEX(`cuiCKey`);
ALTER TABLE `donators` ADD INDEX(`ckey`);
ALTER TABLE `library` ADD INDEX(`ckey`);
ALTER TABLE `library` ADD INDEX(`flagged`);
ALTER TABLE `notes` ADD INDEX(`ckey`);
ALTER TABLE `oauth_tokens` ADD INDEX(`ckey`);