From f0644033758c725ef9fd4830bbd681b0b751af98 Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Thu, 6 Jun 2019 16:58:09 +0200 Subject: [PATCH] Fix SQL files --- SQL/paradise_schema.sql | 34 ++++++++++++++++++++++---------- SQL/paradise_schema_prefixed.sql | 32 +++++++++++++++++++++--------- SQL/updates/5-6.sql | 33 +++++++++++++++++-------------- 3 files changed, 65 insertions(+), 34 deletions(-) diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index e0f33226e8c..6d0a0877312 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -266,8 +266,8 @@ CREATE TABLE `player` ( `exp` mediumtext, `clientfps` smallint(4) DEFAULT '0', `atklog` smallint(4) DEFAULT '0', - `fuid` BIGINT(20) NULL DEFAULT NULL, - `fupdate` SMALLINT(4) NULL DEFAULT 0, + `fuid` bigint(20) NULL DEFAULT NULL, + `fupdate` smallint(4) NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) ) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1; @@ -531,11 +531,11 @@ DROP TABLE IF EXISTS `ipintel`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ipintel` ( -`ip` INT UNSIGNED NOT NULL , -`date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL , -`intel` REAL NOT NULL DEFAULT '0', -PRIMARY KEY ( `ip` ) -) ENGINE = INNODB; + `ip` int UNSIGNED NOT NULL, + `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, + `intel` real NOT NULL DEFAULT '0', + PRIMARY KEY (`ip`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -545,7 +545,21 @@ DROP TABLE IF EXISTS `vpn_whitelist`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `vpn_whitelist` ( - `ckey` VARCHAR(32) NOT NULL, - `reason` text + `ckey` varchar(32) NOT NULL, + `reason` text, PRIMARY KEY (`ckey`) -) ENGINE=INNODB; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `oauth_tokens` +-- +DROP TABLE IF EXISTS `oauth_tokens`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `oauth_tokens` ( + `ckey` varchar(32) NOT NULL, + `token` varchar(32) NOT NULL, + PRIMARY KEY (`token`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index ecb28a867e4..04109d36b49 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -265,8 +265,8 @@ CREATE TABLE `SS13_player` ( `exp` mediumtext, `clientfps` smallint(4) DEFAULT '0', `atklog` smallint(4) DEFAULT '0', - `fuid` BIGINT(20) NULL DEFAULT NULL, - `fupdate` SMALLINT(4) NULL DEFAULT 0, + `fuid` bigint(20) NULL DEFAULT NULL, + `fupdate` smallint(4) NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) ) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1; @@ -530,11 +530,11 @@ DROP TABLE IF EXISTS `SS13_ipintel`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `SS13_ipintel` ( -`ip` INT UNSIGNED NOT NULL , -`date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL , -`intel` REAL NOT NULL DEFAULT '0', -PRIMARY KEY ( `ip` ) -) ENGINE = INNODB; + `ip` int UNSIGNED NOT NULL, + `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, + `intel` real NOT NULL DEFAULT '0', + PRIMARY key (`ip`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -544,7 +544,21 @@ DROP TABLE IF EXISTS `SS13_vpn_whitelist`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `SS13_vpn_whitelist` ( - `ckey` VARCHAR(32) NOT NULL, + `ckey` varchar(32) NOT NULL, `reason` text, PRIMARY KEY (`ckey`) -) ENGINE=INNODB; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `SS13_oauth_tokens` +-- +DROP TABLE IF EXISTS `SS13_oauth_tokens`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `SS13_oauth_tokens` ( + `ckey` varchar(32) NOT NULL, + `token` varchar(32) NOT NULL, + PRIMARY KEY (`token`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/SQL/updates/5-6.sql b/SQL/updates/5-6.sql index 91bf4328a2a..ac3be8f8ef8 100644 --- a/SQL/updates/5-6.sql +++ b/SQL/updates/5-6.sql @@ -1,34 +1,37 @@ #Updating the SQL from version 5 to version 6. -Kyep #Make a table to track the results of VPN/proxy lookups for IPs (IPINTEL, TG PORT) -CREATE TABLE `ipintel` ( -`ip` INT UNSIGNED NOT NULL , -`date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL , -`intel` REAL NOT NULL DEFAULT '0', -PRIMARY KEY ( `ip` ) -) ENGINE = INNODB; +DROP TABLE IF EXISTS `ipintel`; +CREATE TABLE `ipintel` ( + `ip` int UNSIGNED NOT NULL, + `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, + `intel` real NOT NULL DEFAULT '0', + PRIMARY KEY (`ip`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; #Make a table to track which ckeys are whitelisted for use of VPNs (IPINTEL, CUSTOM) +DROP TABLE IF EXISTS `vpn_whitelist`; CREATE TABLE `vpn_whitelist` ( - `ckey` VARCHAR(32) NOT NULL, + `ckey` varchar(32) NOT NULL, `reason` text, PRIMARY KEY (`ckey`) -) ENGINE=INNODB; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; -# Add fuid (forum userid) which enables quick lookup of which ckey is associated with a specific forum account. (FORUM LINK) -ALTER TABLE `player` ADD `fuid` BIGINT(20) NULL DEFAULT NULL; +#Add fuid (forum userid) which enables quick lookup of which ckey is associated with a specific forum account. (FORUM LINK) +ALTER TABLE `player` ADD `fuid` bigint(20) NULL DEFAULT NULL; ALTER TABLE `player` ADD INDEX(`fuid`); -# Add fupdate (forum update required) which flags specific ckeys as having been banned/unbanned, which requires an update of their forum/etc permissions (FORUM LINK) -ALTER TABLE `player` ADD `fupdate` SMALLINT(4) NULL DEFAULT 0; +#Add fupdate (forum update required) which flags specific ckeys as having been banned/unbanned, which requires an update of their forum/etc permissions (FORUM LINK) +ALTER TABLE `player` ADD `fupdate` smallint(4) NULL DEFAULT 0; ALTER TABLE `player` ADD INDEX(`fupdate`); #Make a table to track oauth tokens for linking forum/web accounts (FORUM LINK) +DROP TABLE IF EXISTS `oauth_tokens`; CREATE TABLE `oauth_tokens` ( - `ckey` VARCHAR(32) NOT NULL, - `token` VARCHAR(32) NOT NULL, + `ckey` varchar(32) NOT NULL, + `token` varchar(32) NOT NULL, PRIMARY KEY (`token`) -) ENGINE=INNODB; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; #Drop the old 'discord' table that is not used anymore DROP TABLE `discord`;