Location: PHPKode > scripts > Football Pool > football-pool/data/install.txt
CREATE TABLE IF NOT EXISTS `{$prefix}rankings` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `user_defined` tinyint(3) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}rankings_matches` (
  `ranking_id` int(11) NOT NULL,
  `match_id` int(11) NOT NULL,
  PRIMARY KEY (`ranking_id`,`match_id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}rankings_bonusquestions` (
  `ranking_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  PRIMARY KEY (`ranking_id`,`question_id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}shoutbox` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(11) unsigned NOT NULL DEFAULT '0',
  `shoutText` tinytext NOT NULL DEFAULT '',
  `dateEntered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `dateEntered` (`dateEntered`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}bonusquestions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `question` text NOT NULL DEFAULT '',
  `answer` varchar(200) NOT NULL DEFAULT '',
  `points` smallint(5) unsigned NOT NULL DEFAULT '0',
  `answerBeforeDate` datetime NOT NULL,
  `scoreDate` datetime DEFAULT NULL,
  `matchNr` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}bonusquestions_type` (
  `question_id` int(11) unsigned NOT NULL,
  `type` int(10) unsigned NOT NULL,
  `options` text NOT NULL,
  `image` text NOT NULL,
  `max_answers` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`question_id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}bonusquestions_useranswers` (
  `questionId` int(11) unsigned NOT NULL,
  `userId` int(11) unsigned NOT NULL,
  `answer` text NOT NULL DEFAULT '',
  `correct` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `points` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`questionId`,`userId`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}groups` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(40) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}leagues` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `userDefined` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `image` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}league_users` (
  `userId` int(11) unsigned NOT NULL DEFAULT '0',
  `leagueId` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`userId`),
  KEY `user_league` (`userId`,`leagueId`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}matches` (
  `nr` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `stadiumId` int(11) unsigned NOT NULL,
  `homeTeamId` int(11) NOT NULL,
  `awayTeamId` int(11) NOT NULL,
  `homeScore` tinyint(3) unsigned DEFAULT NULL,
  `awayScore` tinyint(3) unsigned DEFAULT NULL,
  `playDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `matchtypeId` int(11) unsigned NOT NULL,
  PRIMARY KEY (`nr`),
  KEY `ixAwayTeam` (`awayTeamId`),
  KEY `ixHomeTeam` (`homeTeamId`),
  KEY `ixStadium` (`stadiumId`),
  KEY `ixMatchtype` (`matchtypeId`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}matchtypes` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(30) NOT NULL DEFAULT '',
  `visibility` tinyint(3) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}predictions` (
  `userId` int(11) unsigned NOT NULL DEFAULT '0',
  `matchNr` int(4) unsigned NOT NULL DEFAULT '0',
  `homeScore` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `awayScore` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `hasJoker` tinyint(4) NOT NULL DEFAULT '0',
  UNIQUE KEY `ixUserMatch` (`userId`,`matchNr`),
  KEY `ixUser` (`userId`),
  KEY `ixMatch` (`matchNr`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}scorehistory` (
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `scoreDate` datetime NOT NULL,
  `scoreOrder` int(11) unsigned NOT NULL,
  `userId` int(11) unsigned NOT NULL,
  `score` int(11) unsigned NOT NULL,
  `full` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `toto` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `goal_bonus` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `totalScore` int(11) unsigned NOT NULL DEFAULT '0',
  `ranking` int(11) unsigned NOT NULL,
  `ranking_id` int(11) unsigned DEFAULT NULL,
  KEY `scoreDate` (`scoreDate`),
  KEY `scoreDate_2` (`scoreDate`,`userId`),
  KEY `totalScore` (`totalScore`),
  KEY `type` (`type`,`scoreDate`,`scoreOrder`),
  KEY `ranking_id` (`ranking_id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}stadiums` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `photo` text NOT NULL DEFAULT '',
  `comments` text,
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{$prefix}teams` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '',
  `photo` text NOT NULL,
  `flag` text NOT NULL,
  `link` varchar(200) NOT NULL DEFAULT '',
  `groupId` int(11) NOT NULL DEFAULT '0',
  `groupOrder` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `is_real` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `is_active` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `comments` text,
  PRIMARY KEY (`id`),
  KEY `ixGroup` (`groupId`),
  KEY `ixGroupOrder` (`groupOrder`)
) DEFAULT CHARSET=utf8;
Return current item: Football Pool