function createTable()
    {
        $this->db->execute(<<<EOAlly
CREATE TABLE IF NOT EXISTS `Allies` (
\t`playerLogin` VARCHAR(25) NOT NULL,
\t`allyLogin` VARCHAR(25) NOT NULL,
\t`lobbyLogin` VARCHAR(25) NOT NULL,
\t`scriptName` VARCHAR(75) NOT NULL,
\t`titleIdString` VARCHAR(51) NOT NULL,
\t`disconnectionDate` DATETIME NULL DEFAULT NULL,
\tPRIMARY KEY (`playerLogin`, `allyLogin`, `lobbyLogin`, `scriptName`, `titleIdString`),
\tINDEX `allyLogin` (`allyLogin`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOAlly
);
    }
    function createTables()
    {
        $this->db->execute(<<<EOLobbyServers
CREATE TABLE IF NOT EXISTS `LobbyServers` (
\t`login` VARCHAR(25) NOT NULL,
\t`name` VARCHAR(76) NOT NULL,
\t`backLink` VARCHAR(76) NOT NULL,
\t`readyPlayers` INT NOT NULL,
\t`connectedPlayers` INT NOT NULL,
\tPRIMARY KEY (`login`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOLobbyServers
);
        $this->db->execute(<<<EOMatchServers
CREATE TABLE IF NOT EXISTS `MatchServers` (
\t`login` VARCHAR(25) NOT NULL,
\t`lobbyLogin` VARCHAR(25) NOT NULL,
\t`state` INT NOT NULL COMMENT '-2: player left, -1 waiting, 1 sleeping, 2 deciding, 3 playing, 4 over',
\t`lastLive` DATETIME NOT NULL,
\t`scriptName` VARCHAR(75) NOT NULL,
\t`titleIdString` VARCHAR(51) NOT NULL,
\t`matchId` INT(10) NULL DEFAULT NULL,
\t`currentMap` VARCHAR(60) NOT NULL DEFAULT '',
\tPRIMARY KEY (`login`, `scriptName`, `titleIdString`),
\tINDEX `FK_MatchServers_Lobbies_idx` (`lobbyLogin`),
\tCONSTRAINT `FK_MatchServers_LobbyServers` FOREIGN KEY (`lobbyLogin`) REFERENCES `LobbyServers` (`login`) ON UPDATE CASCADE ON DELETE NO ACTION
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOMatchServers
);
        $this->db->execute(<<<EOMatches
CREATE TABLE IF NOT EXISTS `Matches` (
\t`id` INT NOT NULL AUTO_INCREMENT,
\t`creationDate` DATETIME NOT NULL,
\t`state` INT NOT NULL COMMENT '1:playing, -1: preparing, -2: player left, -3: player gave p, -4: over fine',
\t`matchServerLogin` VARCHAR(25) NOT NULL,
\t`scriptName` VARCHAR(75) NOT NULL,
\t`titleIdString` VARCHAR(51) NOT NULL,
\t`lobbyLogin` VARCHAR(25) NOT NULL,
\t`lastUpdateDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
\t`matchPointsTeam1` INT(10) NOT NULL DEFAULT '0',
\t`matchPointsTeam2` INT(10) NOT NULL DEFAULT '0',
\t`mapPointsTeam1` INT(10) NOT NULL DEFAULT '0',
\t`mapPointsTeam2` INT(10) NOT NULL DEFAULT '0',
\tPRIMARY KEY (`id`),
\tINDEX `FK_Matches_MatchServers_idx` (`matchServerLogin`),
\tINDEX `FK_Matches_MatchServers` (`matchServerLogin`, `scriptName`, `titleIdString`),
\tCONSTRAINT `FK_Matches_MatchServers` FOREIGN KEY (`matchServerLogin`, `scriptName`, `titleIdString`) REFERENCES `MatchServers` (`login`, `scriptName`, `titleIdString`) ON UPDATE CASCADE ON DELETE NO ACTION,
\tCONSTRAINT `FK_Matches_LobbyServers` FOREIGN KEY (`lobbyLogin`) REFERENCES `LobbyServers` (`login`) ON UPDATE CASCADE ON DELETE NO ACTION
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOMatches
);
        $this->db->execute(<<<EOPlayers
CREATE TABLE IF NOT EXISTS `Players` (
\t`login` VARCHAR(25) NOT NULL,
\t`matchId` INT NOT NULL,
\t`teamId` INT NULL DEFAULT NULL,
\t`state` INT NOT NULL DEFAULT '0',
\t`rank` INT NOT NULL DEFAULT '0',
\tPRIMARY KEY (`login`, `matchId`),
\tINDEX `FK_Players_Matches_idx` (`matchId`),
\tCONSTRAINT `FK_Players_Matches` FOREIGN KEY (`matchId`) REFERENCES `Matches` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOPlayers
);
        $this->db->execute(<<<EOPenalties
CREATE TABLE IF NOT EXISTS  `PlayersPenalties` (
\t`playerLogin` VARCHAR(25) NOT NULL,
\t`lobbyLogin` VARCHAR(25) NOT NULL,
\t`scriptName` VARCHAR(75) NOT NULL,
\t`titleIdString` VARCHAR(51) NOT NULL,
\t`secondsLeft` INT(10) UNSIGNED NOT NULL DEFAULT '0',
\t`total` INT(10) UNSIGNED NOT NULL DEFAULT '0',
\tPRIMARY KEY (`playerLogin`, `lobbyLogin`, `scriptName`, `titleIdString`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOPenalties
);
        $this->db->execute(<<<EOQuery
CREATE TABLE IF NOT EXISTS `Masters` (
\t`id` INT(11) NOT NULL AUTO_INCREMENT,
\t`lobbyLogin` VARCHAR(25) NOT NULL,
\t`scriptName` VARCHAR(75) NOT NULL,
\t`titleIdString` VARCHAR(51) NOT NULL,
\t`login` VARCHAR(25) NOT NULL,
\t`nickName` VARCHAR(255) NOT NULL,
\t`ladderPoints` MEDIUMINT UNSIGNED NOT NULL NULL,
\tPRIMARY KEY (`id`),
\tINDEX `lobbyLogin_scriptName_titleIdString` (`lobbyLogin`, `scriptName`, `titleIdString`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
EOQuery
);
    }