BUGFIX: show correct name of all players, when looking at games of other players
[e-DoKo.git] / create_database.sql
index 396862dd191102b28b01f362ac3a7946672de3d5..40a008aadb1caa1654e2b18e4356782ce466e4dd 100644 (file)
 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 
+
+--
+-- Table structure for table `Version`
+--
+
+DROP TABLE IF EXISTS `Version`;
+CREATE TABLE `Version` (
+  `version` int NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `Card`
+--
+
+
+/*!40000 ALTER TABLE `Card` DISABLE KEYS */;
+LOCK TABLES `Version` WRITE;
+INSERT INTO `Version` VALUES (1);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `Version` ENABLE KEYS */;
+
+
 --
 -- Table structure for table `Card`
 --
@@ -62,6 +84,30 @@ LOCK TABLES `Comment` WRITE;
 UNLOCK TABLES;
 /*!40000 ALTER TABLE `Comment` ENABLE KEYS */;
 
+--
+-- Table structure for table `Notes`
+--
+
+DROP TABLE IF EXISTS `Notes`;
+CREATE TABLE `Notes` (
+  `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+  `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
+  `id` int(11) NOT NULL auto_increment,
+  `user_id` int(11) default NULL,
+  `game_id` int(11) default NULL,
+  `comment` text,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `Notes`
+--
+
+/*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
+LOCK TABLES `Notes` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
+
 --
 -- Table structure for table `Game`
 --
@@ -74,13 +120,14 @@ CREATE TABLE `Game` (
   `type` enum('normal','solo','wedding','poverty','dpoverty') default NULL,
   `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
   `sickness` int(11) default NULL,
-  `startplayer` tinyint(4) default '1', 
-  `player` int(11) default NULL, 
-  `status` enum('pre','play','gameover') default NULL,
+  `startplayer` tinyint(4) default '1',
+  `player` int(11) default NULL,
+  `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay') default NULL,
   `ruleset` int(11) default NULL,
   `session` int(11) default NULL,
   `id` int(11) NOT NULL auto_increment,
-  UNIQUE KEY `id` (`id`)
+  UNIQUE KEY `id` (`id`),
+  KEY `session` (`session`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
 --
@@ -108,7 +155,7 @@ CREATE TABLE `Rulesets` (
   `id` int(11) NOT NULL auto_increment,
   UNIQUE KEY `id` (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-  
+
 --
 -- Dumping data for table `Rulesets`
 --
@@ -176,6 +223,32 @@ LOCK TABLES `Hand_Card` WRITE;
 UNLOCK TABLES;
 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
 
+--
+-- Table structure for table `Card_Exchange`
+--
+
+DROP TABLE IF EXISTS `Card_Exchange`;
+CREATE TABLE `Card_Exchange` (
+  `id` int(11) NOT NULL auto_increment,
+  `orig_hand_id` int(11) NOT NULL default '0',
+  `new_hand_id` int(11) NOT NULL default '0',
+  `card_id` int(11) NOT NULL default '0',
+  UNIQUE KEY `id` (`id`),
+  KEY `orig_hand_id` (`orig_hand_id`),
+  KEY `new_hand_id` (`new_hand_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `Hand_Card`
+--
+
+
+/*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
+LOCK TABLES `Hand_Card` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
+
+
 --
 -- Table structure for table `Play`
 --
@@ -214,7 +287,7 @@ CREATE TABLE `Score` (
   `party` enum('re','contra') default NULL ,
   `winner_id` int(11) default NULL ,
   `looser_id` int(11) default NULL ,
-  `score` enum('120', 'call120','against120','90','call90','against90','made90'
+  `score` enum('120', 'call120','against120','90','call90','against90','made90',
           '60','call60','against60','made60','30','call30','against30','made30',
           '0','call0','against0','made0',
           'fox','karlchen','dulle','doko','againstqueens') default NULL,
@@ -269,6 +342,7 @@ CREATE TABLE `User` (
   `password` varchar(32) default NULL,
   `timezone` varchar(64) default 'Europe/London',
   `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
+  `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
   UNIQUE KEY `id` (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
@@ -383,3 +457,23 @@ UNLOCK TABLES;
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 
+DROP TABLE IF EXISTS `user_openids`;
+create table user_openids (
+  openid_url varchar(255) not null,
+  primary key (openid_url),
+
+  user_id int not null,
+  index (user_id)
+);
+
+DROP TABLE IF EXISTS `digest_email`;
+create table digest_email (
+  `id` int(11) NOT NULL auto_increment,
+  `email` varchar(255) default null,
+  `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
+  `content` text,
+  UNIQUE KEY `id` (`id`),
+  index (email)
+);
+
+