-- MySQL commands to install Peter's Sports League Standings Version 1.3

-- 
-- Table structure for table `sportsdb_conferences`
-- 

CREATE TABLE `sportsdb_conferences` (
  `confid` int(11) NOT NULL auto_increment,
  `confname` varchar(255) NOT NULL default '',
  `conforder` int(11) NOT NULL default '0',
  `season` int(11) NOT NULL default '1',
  KEY `confid` (`confid`)
) AUTO_INCREMENT=2 ;

-- 
-- Dumping data for table `sportsdb_conferences`
-- 

INSERT INTO `sportsdb_conferences` (`confid`, `confname`, `conforder`, `season`) VALUES 
(1, 'Delta', 11, 1);

-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_divs`
-- 

CREATE TABLE `sportsdb_divs` (
  `divid` int(11) NOT NULL auto_increment,
  `divname` varchar(255) NOT NULL default '',
  `divorder` int(11) NOT NULL default '0',
  `conference` int(11) NOT NULL default '1',
  KEY `divid` (`divid`)
) AUTO_INCREMENT=3 ;

-- 
-- Dumping data for table `sportsdb_divs`
-- 

INSERT INTO `sportsdb_divs` (`divid`, `divname`, `divorder`, `conference`) VALUES 
(1, 'Pacific Division', 10, 1),
(2, 'Peter&#039;s division', 20, 1);

-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_limitations`
-- 

CREATE TABLE `sportsdb_limitations` (
  `limitation_id` int(11) NOT NULL auto_increment,
  `type` enum('conf','div','team') NOT NULL,
  `policy_id` int(11) NOT NULL,
  `limitation_value` int(11) NOT NULL,
  UNIQUE KEY `limitation_id` (`limitation_id`),
  UNIQUE KEY `type` (`type`,`policy_id`,`limitation_value`)
) AUTO_INCREMENT=1 ;

-- 
-- Dumping data for table `sportsdb_limitations`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_masterteams`
-- 

CREATE TABLE `sportsdb_masterteams` (
  `masterteamid` int(11) NOT NULL auto_increment,
  `masterteamname` varchar(255) NOT NULL,
  `masterteamactive` tinyint(1) NOT NULL default '1',
  UNIQUE KEY `masterteamid` (`masterteamid`)
) AUTO_INCREMENT=5 ;

-- 
-- Dumping data for table `sportsdb_masterteams`
-- 

INSERT INTO `sportsdb_masterteams` (`masterteamid`, `masterteamname`, `masterteamactive`) VALUES 
(1, 'Geminis', 1),
(2, 'The Fridays', 1),
(3, 'Stallions', 1),
(4, 'Pandas', 1);

-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_permissions`
-- 

CREATE TABLE `sportsdb_permissions` (
  `policy_id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL,
  `level` enum('manage_score','manage_team','manage_div','manage_conf') NOT NULL,
  UNIQUE KEY `policy_id` (`policy_id`)
) AUTO_INCREMENT=1 ;

-- 
-- Dumping data for table `sportsdb_permissions`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_seasons`
-- 

CREATE TABLE `sportsdb_seasons` (
  `seasonid` int(11) NOT NULL auto_increment,
  `seasonname` varchar(255) NOT NULL,
  `seasonorder` int(11) NOT NULL,
  UNIQUE KEY `seasonid` (`seasonid`)
) AUTO_INCREMENT=2 ;

-- 
-- Dumping data for table `sportsdb_seasons`
-- 

INSERT INTO `sportsdb_seasons` (`seasonid`, `seasonname`, `seasonorder`) VALUES 
(1, '2008', 10);

-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_teams`
-- 

CREATE TABLE `sportsdb_teams` (
  `teamid` int(11) NOT NULL auto_increment,
  `teamname` varchar(255) NOT NULL default '',
  `teamwins` int(11) NOT NULL default '0',
  `teamlosses` int(11) NOT NULL default '0',
  `teamties` int(11) NOT NULL default '0',
  `teamforfeits` int(11) NOT NULL default '0',
  `teamrf` int(6) NOT NULL default '0',
  `teamra` int(6) NOT NULL default '0',
  `teamdiv` int(11) NOT NULL default '1',
  `teamorder` int(2) NOT NULL default '0',
  `active` int(11) NOT NULL default '1',
  `masterteam` int(11) NOT NULL,
  UNIQUE KEY `teamid` (`teamid`)
) AUTO_INCREMENT=5 ;

-- 
-- Dumping data for table `sportsdb_teams`
-- 

INSERT INTO `sportsdb_teams` (`teamid`, `teamname`, `teamwins`, `teamlosses`, `teamties`, `teamforfeits`, `teamrf`, `teamra`, `teamdiv`, `teamorder`, `active`, `masterteam`) VALUES 
(-1, 'TBD', 0, 0, 0, 0, 0, 0, 0, 0, 1, -1),
(1, 'Geminis', 1, 1, 0, 0, 7, 6, 1, 0, 1, 1),
(2, 'The Fridays', 1, 1, 0, 0, 8, 7, 2, 0, 1, 2),
(3, 'Stallions', 1, 0, 0, 0, 5, 4, 2, 0, 1, 3),
(4, 'Pandas', 0, 1, 0, 0, 2, 5, 1, 0, 1, 4);

-- --------------------------------------------------------

-- 
-- Table structure for table `sportsdb_wins`
-- 

CREATE TABLE `sportsdb_wins` (
  `winid` int(11) NOT NULL auto_increment,
  `windate` int(20) NOT NULL default '0',
  `wintime` int(11) NOT NULL default '0',
  `field` varchar(255) NOT NULL default '',
  `winner` varchar(255) NOT NULL default '0',
  `loser` varchar(255) NOT NULL default '0',
  `rf` int(3) NOT NULL default '0',
  `ra` int(3) NOT NULL default '0',
  `wincomments` varchar(255) NOT NULL default '',
  `winortie` int(1) NOT NULL default '3',
  `winconf` int(11) NOT NULL,
  KEY `winid` (`winid`)
) AUTO_INCREMENT=5 ;

-- 
-- Dumping data for table `sportsdb_wins`
-- 

INSERT INTO `sportsdb_wins` (`winid`, `windate`, `wintime`, `field`, `winner`, `loser`, `rf`, `ra`, `wincomments`, `winortie`, `winconf`) VALUES 
(1, 1140584400, 1140588900, 'Hyde Park', '1', '4', 5, 2, '<font color="red">Test comment</font>', 1, 1),
(2, 1174622400, 1174681800, 'Stanley Park', '3', '2', 5, 4, '', 1, 1),
(3, 1177041600, 1177108200, 'Stanley Park', '1', '2', 2, 4, '', 4, 1),
(4, 1203483600, 1203526800, 'Peter', '1', '4', 0, 0, '', 3, 1);