1 /* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
3 * This file is part of e-DoKo.
5 * e-DoKo is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * e-DoKo is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with e-DoKo. If not, see <http://www.gnu.org/licenses/>.
22 -- Host: localhost Database: doko
23 -- ------------------------------------------------------
24 -- Server version 4.1.10
26 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
27 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
28 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
29 /*!40101 SET NAMES utf8 */;
30 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
31 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
32 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
36 -- Table structure for table `Version`
39 DROP TABLE IF EXISTS `Version`;
40 CREATE TABLE `Version` (
41 `version` int NOT NULL default '0'
42 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
45 -- Dumping data for table `Card`
49 /*!40000 ALTER TABLE `Card` DISABLE KEYS */;
50 LOCK TABLES `Version` WRITE;
51 INSERT INTO `Version` VALUES (2);
53 /*!40000 ALTER TABLE `Version` ENABLE KEYS */;
57 -- Table structure for table `Card`
60 DROP TABLE IF EXISTS `Card`;
62 `id` int(11) NOT NULL auto_increment,
63 `suite` enum('diamonds','hearts','spades','clubs') NOT NULL default 'diamonds',
64 `strength` enum('nine','ten','jack','queen','king','ace') NOT NULL default 'nine',
65 `points` tinyint(4) NOT NULL default '0',
66 UNIQUE KEY `id` (`id`)
67 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
70 -- Dumping data for table `Card`
74 /*!40000 ALTER TABLE `Card` DISABLE KEYS */;
75 LOCK TABLES `Card` WRITE;
76 INSERT INTO `Card` VALUES (1,'hearts','ten',10),(2,'hearts','ten',10),(3,'clubs','queen',3),(4,'clubs','queen',3),(5,'spades','queen',3),(6,'spades','queen',3),(7,'hearts','queen',3),(8,'hearts','queen',3),(9,'diamonds','queen',3),(10,'diamonds','queen',3),(11,'clubs','jack',2),(12,'clubs','jack',2),(13,'spades','jack',2),(14,'spades','jack',2),(15,'hearts','jack',2),(16,'hearts','jack',2),(17,'diamonds','jack',2),(18,'diamonds','jack',2),(19,'diamonds','ace',11),(20,'diamonds','ace',11),(21,'diamonds','ten',10),(22,'diamonds','ten',10),(23,'diamonds','king',4),(24,'diamonds','king',4),(25,'diamonds','nine',0),(26,'diamonds','nine',0),(27,'clubs','ace',11),(28,'clubs','ace',11),(29,'clubs','ten',10),(30,'clubs','ten',10),(31,'clubs','king',4),(32,'clubs','king',4),(33,'clubs','nine',0),(34,'clubs','nine',0),(35,'spades','ace',11),(36,'spades','ace',11),(37,'spades','ten',10),(38,'spades','ten',10),(39,'spades','king',4),(40,'spades','king',4),(41,'spades','nine',0),(42,'spades','nine',0),(43,'hearts','ace',11),(44,'hearts','ace',11),(45,'hearts','king',4),(46,'hearts','king',4),(47,'hearts','nine',0),(48,'hearts','nine',0);
78 /*!40000 ALTER TABLE `Card` ENABLE KEYS */;
81 -- Table structure for table `Comment`
84 DROP TABLE IF EXISTS `Comment`;
85 CREATE TABLE `Comment` (
86 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
87 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
88 `id` int(11) NOT NULL auto_increment,
89 `user_id` int(11) default NULL,
90 `play_id` int(11) default NULL,
92 UNIQUE KEY `id` (`id`),
93 KEY `play_id` (`play_id`)
94 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
97 -- Dumping data for table `Comment`
101 /*!40000 ALTER TABLE `Comment` DISABLE KEYS */;
102 LOCK TABLES `Comment` WRITE;
104 /*!40000 ALTER TABLE `Comment` ENABLE KEYS */;
107 -- Table structure for table `Notes`
110 DROP TABLE IF EXISTS `Notes`;
111 CREATE TABLE `Notes` (
112 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
113 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
114 `id` int(11) NOT NULL auto_increment,
115 `user_id` int(11) default NULL,
116 `game_id` int(11) default NULL,
118 UNIQUE KEY `id` (`id`)
119 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
122 -- Dumping data for table `Notes`
125 /*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
126 LOCK TABLES `Notes` WRITE;
128 /*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
131 -- Table structure for table `Game`
134 DROP TABLE IF EXISTS `Game`;
135 CREATE TABLE `Game` (
136 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
137 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
138 `randomnumbers` varchar(136) default NULL,
139 `type` enum('normal','solo','wedding','poverty','dpoverty') default NULL,
140 `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
141 `sickness` int(11) default NULL,
142 `startplayer` tinyint(4) default '1',
143 `player` int(11) default NULL,
144 `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay','cancel-lowtrump') default NULL,
145 `ruleset` int(11) default NULL,
146 `session` int(11) default NULL,
147 `id` int(11) NOT NULL auto_increment,
148 UNIQUE KEY `id` (`id`),
149 KEY `session` (`session`)
150 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
153 -- Dumping data for table `Game`
157 /*!40000 ALTER TABLE `Game` DISABLE KEYS */;
158 LOCK TABLES `Game` WRITE;
160 /*!40000 ALTER TABLE `Game` ENABLE KEYS */;
164 -- Table structure for table `Ruleset`
167 DROP TABLE IF EXISTS `Rulesets`;
168 CREATE TABLE `Rulesets` (
169 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
170 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
171 `dullen` enum('none','firstwins','secondwins') default 'secondwins',
172 `schweinchen` enum ('none','both','second','secondaftercall') default 'second',
173 `call` enum ('1st-own-card','5th-card','9-cards') default '1st-own-card',
174 `lowtrump` enum('poverty','cancel','none') default 'poverty',
175 `id` int(11) NOT NULL auto_increment,
176 UNIQUE KEY `id` (`id`)
177 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
180 -- Dumping data for table `Rulesets`
184 /*!40000 ALTER TABLE `Rulesets` DISABLE KEYS */;
185 LOCK TABLES `Rulesets` WRITE;
187 /*!40000 ALTER TABLE `Rulesets` ENABLE KEYS */;
192 -- Table structure for table `Hand`
195 DROP TABLE IF EXISTS `Hand`;
196 CREATE TABLE `Hand` (
197 `id` int(11) NOT NULL auto_increment,
198 `game_id` int(11) NOT NULL default '0',
199 `user_id` int(11) NOT NULL default '0',
200 `hash` varchar(33) default NULL,
201 `status` enum('start','init','check','poverty','play','gameover') default 'start',
202 `position` tinyint(4) NOT NULL default '0',
203 `party` enum('re','contra') default NULL,
204 `sickness` enum('wedding','nines','poverty','solo','lowtrump') default NULL,
205 `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
206 `point_call` enum('120','90','60','30','0') default NULL,
207 UNIQUE KEY `id` (`id`),
208 KEY `game_id` (`game_id`),
209 KEY `user_id` (`user_id`)
210 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
213 -- Dumping data for table `Hand`
217 /*!40000 ALTER TABLE `Hand` DISABLE KEYS */;
218 LOCK TABLES `Hand` WRITE;
220 /*!40000 ALTER TABLE `Hand` ENABLE KEYS */;
223 -- Table structure for table `Hand_Card`
226 DROP TABLE IF EXISTS `Hand_Card`;
227 CREATE TABLE `Hand_Card` (
228 `id` int(11) NOT NULL auto_increment,
229 `hand_id` int(11) NOT NULL default '0',
230 `card_id` int(11) NOT NULL default '0',
231 `played` enum('true','false') default 'false',
232 UNIQUE KEY `id` (`id`),
233 KEY `hand_id` (`hand_id`)
234 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
237 -- Dumping data for table `Hand_Card`
241 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
242 LOCK TABLES `Hand_Card` WRITE;
244 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
247 -- Table structure for table `Card_Exchange`
250 DROP TABLE IF EXISTS `Card_Exchange`;
251 CREATE TABLE `Card_Exchange` (
252 `id` int(11) NOT NULL auto_increment,
253 `orig_hand_id` int(11) NOT NULL default '0',
254 `new_hand_id` int(11) NOT NULL default '0',
255 `card_id` int(11) NOT NULL default '0',
256 UNIQUE KEY `id` (`id`),
257 KEY `orig_hand_id` (`orig_hand_id`),
258 KEY `new_hand_id` (`new_hand_id`)
259 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
262 -- Dumping data for table `Hand_Card`
266 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
267 LOCK TABLES `Card_Exchange` WRITE;
269 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
273 -- Table structure for table `Play`
276 DROP TABLE IF EXISTS `Play`;
277 CREATE TABLE `Play` (
278 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
279 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
280 `id` int(11) NOT NULL auto_increment,
281 `trick_id` int(11) NOT NULL default '0',
282 `hand_card_id` int(11) NOT NULL default '0',
283 `sequence` tinyint(4) NOT NULL default '0',
284 UNIQUE KEY `id` (`id`),
285 KEY `trick_id` (`trick_id`)
286 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
289 -- Dumping data for table `Play`
293 /*!40000 ALTER TABLE `Play` DISABLE KEYS */;
294 LOCK TABLES `Play` WRITE;
296 /*!40000 ALTER TABLE `Play` ENABLE KEYS */;
299 -- Table structure for table `Score`
302 DROP TABLE IF EXISTS `Score`;
303 CREATE TABLE `Score` (
304 `id` int(11) NOT NULL auto_increment,
305 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
306 `game_id` int(11) NOT NULL default '0',
307 `party` enum('re','contra') default NULL ,
308 `winner_id` int(11) default NULL ,
309 `looser_id` int(11) default NULL ,
310 `score` enum('120', 'call120','against120','90','call90','against90','made90',
311 '60','call60','against60','made60','30','call30','against30','made30',
312 '0','call0','against0','made0',
313 'fox','karlchen','dulle','doko','againstqueens') default NULL,
314 UNIQUE KEY `id` (`id`),
315 KEY `game_id` (`game_id`)
316 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
319 -- Dumping data for table `Score`
323 /*!40000 ALTER TABLE `Score` DISABLE KEYS */;
324 LOCK TABLES `Score` WRITE;
326 /*!40000 ALTER TABLE `Score` ENABLE KEYS */;
329 -- Table structure for table `Trick`
332 DROP TABLE IF EXISTS `Trick`;
333 CREATE TABLE `Trick` (
334 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
335 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
336 `id` int(11) NOT NULL auto_increment,
337 `game_id` int(11) NOT NULL default '0',
338 `winner` tinyint(4) default NULL,
339 UNIQUE KEY `id` (`id`),
340 KEY `game_id` (`game_id`)
341 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
344 -- Dumping data for table `Trick`
348 /*!40000 ALTER TABLE `Trick` DISABLE KEYS */;
349 LOCK TABLES `Trick` WRITE;
351 /*!40000 ALTER TABLE `Trick` ENABLE KEYS */;
354 -- Table structure for table `User`
357 DROP TABLE IF EXISTS `User`;
358 CREATE TABLE `User` (
359 `id` int(11) NOT NULL auto_increment,
360 `fullname` varchar(64) default NULL,
361 `email` varchar(64) default NULL,
362 `password` varchar(32) default NULL,
363 `timezone` varchar(64) default 'Europe/London',
364 `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
365 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
366 UNIQUE KEY `id` (`id`)
367 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
370 -- Dumping data for table `User`
374 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
375 LOCK TABLES `User` WRITE;
377 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
380 -- Table structure for table `User_Game_Prefs`
383 DROP TABLE IF EXISTS `User_Game_Prefs`;
384 CREATE TABLE `User_Game_Prefs` (
385 `id` int(11) NOT NULL auto_increment,
386 `user_id` int(11) NOT NULL default '0',
387 `game_id` int(11) NOT NULL default '0',
388 `pref_key` varchar(64) default NULL,
389 `value` varchar(64) default NULL,
390 UNIQUE KEY `id` (`id`),
391 KEY `user_id` (`user_id`)
392 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
395 -- Dumping data for table `User_Game_Prefs`
399 /*!40000 ALTER TABLE `User_Game_Prefs` DISABLE KEYS */;
400 LOCK TABLES `User_Game_Prefs` WRITE;
402 /*!40000 ALTER TABLE `User_Game_Prefs` ENABLE KEYS */;
405 -- Table structure for table `User_Prefs`
408 DROP TABLE IF EXISTS `User_Prefs`;
409 CREATE TABLE `User_Prefs` (
410 `id` int(11) NOT NULL auto_increment,
411 `user_id` int(11) NOT NULL default '0',
412 `pref_key` varchar(64) default NULL,
413 `value` varchar(64) default NULL,
414 UNIQUE KEY `id` (`id`),
415 KEY `user_id` (`user_id`)
416 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
419 -- Dumping data for table `User_Prefs`
425 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
426 LOCK TABLES `Recovery` WRITE;
428 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
431 DROP TABLE IF EXISTS `Recovery`;
432 CREATE TABLE `Recovery` (
433 `id` int(11) NOT NULL auto_increment,
434 `user_id` int(11) NOT NULL default '0',
435 `password` varchar(32) default NULL,
436 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
437 UNIQUE KEY `id` (`id`)
438 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
441 -- Dumping data for table `Recovery`
444 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
445 LOCK TABLES `Recovery` WRITE;
447 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
449 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
450 LOCK TABLES `Reminder` WRITE;
452 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
454 DROP TABLE IF EXISTS `Reminder`;
455 CREATE TABLE `Reminder` (
456 `id` int(11) NOT NULL auto_increment,
457 `user_id` int(11) NOT NULL default '0',
458 `game_id` int(11) NOT NULL default '0',
459 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
460 UNIQUE KEY `id` (`id`)
461 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
464 -- Dumping data for table `Reminder`
467 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
468 LOCK TABLES `Reminder` WRITE;
470 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
473 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
474 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
475 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
476 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
477 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
478 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
480 DROP TABLE IF EXISTS `user_openids`;
481 create table user_openids (
482 openid_url varchar(255) not null,
483 primary key (openid_url),
485 user_id int not null,
489 DROP TABLE IF EXISTS `digest_email`;
490 create table digest_email (
491 `id` int(11) NOT NULL auto_increment,
492 `email` varchar(255) default null,
493 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
495 UNIQUE KEY `id` (`id`),