- improved table definition queries and removed redundant COLLATEs
This commit is contained in:
parent
b2777d8387
commit
8275744fb2
@ -61,9 +61,11 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
private function initTables() {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SCRIPT_SETTINGS . "` (
|
||||
`serverIndex` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`settingName` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`settingValue` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`serverIndex` int(11) NOT NULL,
|
||||
`settingName` varchar(100) NOT NULL,
|
||||
`settingValue` varchar(500) NOT NULL,
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `setting` (`serverIndex`, `settingName`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Script Settings' AUTO_INCREMENT=1;";
|
||||
|
||||
|
@ -57,9 +57,11 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
private function initTables() {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SERVER_SETTINGS . "` (
|
||||
`serverIndex` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`settingName` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`settingValue` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`serverIndex` int(11) NOT NULL,
|
||||
`settingName` varchar(100) NOT NULL,
|
||||
`settingValue` varchar(500) NOT NULL,
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `setting` (`serverIndex`, `settingName`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Server Settings' AUTO_INCREMENT=1;";
|
||||
$statement = $mysqli->prepare($query);
|
||||
|
@ -91,16 +91,16 @@ class MapManager implements CallbackListener {
|
||||
$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_MAPS . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`mxid` int(11),
|
||||
`uid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`authorLogin` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`fileName` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`environment` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`mapType` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`uid` varchar(50) NOT NULL,
|
||||
`name` varchar(150) NOT NULL,
|
||||
`authorLogin` varchar(100) NOT NULL,
|
||||
`fileName` varchar(100) NOT NULL,
|
||||
`environment` varchar(50) NOT NULL,
|
||||
`mapType` varchar(50) NOT NULL,
|
||||
`changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `uid` (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Map data' AUTO_INCREMENT=1;";
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Map Data' AUTO_INCREMENT=1;";
|
||||
$result = $mysqli->query($query);
|
||||
if ($mysqli->error) {
|
||||
trigger_error($mysqli->error, E_USER_ERROR);
|
||||
|
@ -80,9 +80,9 @@ class PlayerManager implements CallbackListener {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$playerTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLAYERS . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`login` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`nickname` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`path` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`login` varchar(100) NOT NULL,
|
||||
`nickname` varchar(150) NOT NULL,
|
||||
`path` varchar(100) NOT NULL,
|
||||
`authLevel` int(11) NOT NULL DEFAULT '0',
|
||||
`changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`index`),
|
||||
|
@ -47,7 +47,7 @@ class PluginManager {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$pluginsTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLUGINS . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`className` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`className` varchar(100) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`index`),
|
||||
|
@ -104,7 +104,7 @@ class Server implements CallbackListener {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SERVERS . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`login` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`login` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `login` (`login`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servers' AUTO_INCREMENT=1;";
|
||||
|
@ -61,11 +61,11 @@ class SettingManager implements CallbackListener {
|
||||
$typeSet = $defaultType . ",'" . self::TYPE_INT . "'" . ",'" . self::TYPE_REAL . "'" . ",'" . self::TYPE_BOOL . "'" . ",'" . self::TYPE_ARRAY . "'";
|
||||
$settingTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SETTINGS . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`class` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`setting` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`type` set({$typeSet}) COLLATE utf8_unicode_ci NOT NULL DEFAULT {$defaultType},
|
||||
`value` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`default` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`class` varchar(50) NOT NULL,
|
||||
`setting` varchar(50) NOT NULL,
|
||||
`type` set({$typeSet}) NOT NULL DEFAULT {$defaultType},
|
||||
`value` varchar(100) NOT NULL,
|
||||
`default` varchar(100) NOT NULL,
|
||||
`changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `settingId` (`class`,`setting`)
|
||||
@ -202,7 +202,7 @@ class SettingManager implements CallbackListener {
|
||||
@value
|
||||
) ON DUPLICATE KEY UPDATE
|
||||
`type` = VALUES(`type`),
|
||||
`value` = IF(`default` = VALUES(`default`), `value`, VALUES(`default`)),
|
||||
`value` = IF(`default` = VALUES(`default`), `value`, VALUES(`default`)),
|
||||
`default` = VALUES(`default`),
|
||||
`changed` = NOW();";
|
||||
$settingStatement = $mysqli->prepare($settingQuery);
|
||||
|
@ -535,9 +535,9 @@ class StatisticManager {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_STATMETADATA . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`type` int(5) NOT NULL,
|
||||
`description` varchar(150) COLLATE utf8_unicode_ci,
|
||||
`description` varchar(150) NOT NULL,
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Statistics Meta Data' AUTO_INCREMENT=1;";
|
||||
@ -558,7 +558,7 @@ class StatisticManager {
|
||||
`serverIndex` int(11) NOT NULL,
|
||||
`playerId` int(11) NOT NULL,
|
||||
`statId` int(11) NOT NULL,
|
||||
`value` int(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
|
||||
`value` int(20) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`index`),
|
||||
UNIQUE KEY `unique` (`statId`,`playerId`,`serverIndex`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Statistics' AUTO_INCREMENT=1;";
|
||||
|
@ -53,7 +53,8 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_ENABLEUPDATECHECK, true);
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTO_UPDATE, true);
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_INTERVAL, 1);
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, self::CHANNEL_NIGHTLY); //TODO just temp until release
|
||||
// TODO: 'nightly' only during dev
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, self::CHANNEL_NIGHTLY);
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_PERFORM_BACKUPS, true);
|
||||
|
||||
// Register for callbacks
|
||||
|
Loading…
Reference in New Issue
Block a user