1 /* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 '5'
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,
91 `game_id` int(11) default NULL,
93 UNIQUE KEY `id` (`id`),
94 KEY `play_id` (`play_id`)
95 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
98 -- Dumping data for table `Comment`
102 /*!40000 ALTER TABLE `Comment` DISABLE KEYS */;
103 LOCK TABLES `Comment` WRITE;
105 /*!40000 ALTER TABLE `Comment` ENABLE KEYS */;
108 -- Table structure for table `Notes`
111 DROP TABLE IF EXISTS `Notes`;
112 CREATE TABLE `Notes` (
113 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
114 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
115 `id` int(11) NOT NULL auto_increment,
116 `user_id` int(11) default NULL,
117 `game_id` int(11) default NULL,
119 UNIQUE KEY `id` (`id`)
120 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
123 -- Dumping data for table `Notes`
126 /*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
127 LOCK TABLES `Notes` WRITE;
129 /*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
132 -- Table structure for table `Game`
135 DROP TABLE IF EXISTS `Game`;
136 CREATE TABLE `Game` (
137 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
138 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
139 `randomnumbers` varchar(136) default NULL,
140 `type` enum('normal','solo','wedding','poverty','dpoverty') default NULL,
141 `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
142 `sickness` int(11) default NULL,
143 `startplayer` tinyint(4) default '1',
144 `player` int(11) default NULL,
145 `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay','cancel-lowtrump') default NULL,
146 `ruleset` int(11) default NULL,
147 `session` int(11) default NULL,
148 `id` int(11) NOT NULL auto_increment,
149 UNIQUE KEY `id` (`id`),
150 KEY `session` (`session`)
151 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
154 -- Dumping data for table `Game`
158 /*!40000 ALTER TABLE `Game` DISABLE KEYS */;
159 LOCK TABLES `Game` WRITE;
161 /*!40000 ALTER TABLE `Game` ENABLE KEYS */;
165 -- Table structure for table `Ruleset`
168 DROP TABLE IF EXISTS `Rulesets`;
169 CREATE TABLE `Rulesets` (
170 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
171 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
172 `dullen` enum('none','firstwins','secondwins') default 'secondwins',
173 `schweinchen` enum ('none','both','second','secondaftercall') default 'second',
174 `call` enum ('1st-own-card','5th-card','9-cards') default '1st-own-card',
175 `lowtrump` enum('poverty','cancel','none') default 'poverty',
176 `id` int(11) NOT NULL auto_increment,
177 UNIQUE KEY `id` (`id`)
178 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
181 -- Dumping data for table `Rulesets`
185 /*!40000 ALTER TABLE `Rulesets` DISABLE KEYS */;
186 LOCK TABLES `Rulesets` WRITE;
188 /*!40000 ALTER TABLE `Rulesets` ENABLE KEYS */;
193 -- Table structure for table `Hand`
196 DROP TABLE IF EXISTS `Hand`;
197 CREATE TABLE `Hand` (
198 `id` int(11) NOT NULL auto_increment,
199 `game_id` int(11) NOT NULL default '0',
200 `user_id` int(11) NOT NULL default '0',
201 `hash` varchar(33) default NULL,
202 `status` enum('start','init','check','poverty','play','gameover') default 'start',
203 `position` tinyint(4) NOT NULL default '0',
204 `party` enum('re','contra') default NULL,
205 `sickness` enum('wedding','nines','poverty','solo','lowtrump') default NULL,
206 `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
207 `point_call` enum('120','90','60','30','0') default NULL,
208 UNIQUE KEY `id` (`id`),
209 KEY `game_id` (`game_id`),
210 KEY `user_id` (`user_id`)
211 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
214 -- Dumping data for table `Hand`
218 /*!40000 ALTER TABLE `Hand` DISABLE KEYS */;
219 LOCK TABLES `Hand` WRITE;
221 /*!40000 ALTER TABLE `Hand` ENABLE KEYS */;
224 -- Table structure for table `Hand_Card`
227 DROP TABLE IF EXISTS `Hand_Card`;
228 CREATE TABLE `Hand_Card` (
229 `id` int(11) NOT NULL auto_increment,
230 `hand_id` int(11) NOT NULL default '0',
231 `card_id` int(11) NOT NULL default '0',
232 `played` enum('true','false') default 'false',
233 UNIQUE KEY `id` (`id`),
234 KEY `hand_id` (`hand_id`)
235 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
238 -- Dumping data for table `Hand_Card`
242 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
243 LOCK TABLES `Hand_Card` WRITE;
245 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
248 -- Table structure for table `Card_Exchange`
251 DROP TABLE IF EXISTS `Card_Exchange`;
252 CREATE TABLE `Card_Exchange` (
253 `id` int(11) NOT NULL auto_increment,
254 `orig_hand_id` int(11) NOT NULL default '0',
255 `new_hand_id` int(11) NOT NULL default '0',
256 `card_id` int(11) NOT NULL default '0',
257 UNIQUE KEY `id` (`id`),
258 KEY `orig_hand_id` (`orig_hand_id`),
259 KEY `new_hand_id` (`new_hand_id`)
260 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
263 -- Dumping data for table `Hand_Card`
267 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
268 LOCK TABLES `Card_Exchange` WRITE;
270 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
274 -- Table structure for table `Play`
277 DROP TABLE IF EXISTS `Play`;
278 CREATE TABLE `Play` (
279 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
280 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
281 `id` int(11) NOT NULL auto_increment,
282 `trick_id` int(11) NOT NULL default '0',
283 `hand_card_id` int(11) NOT NULL default '0',
284 `sequence` tinyint(4) NOT NULL default '0',
285 UNIQUE KEY `id` (`id`),
286 KEY `trick_id` (`trick_id`)
287 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
290 -- Dumping data for table `Play`
294 /*!40000 ALTER TABLE `Play` DISABLE KEYS */;
295 LOCK TABLES `Play` WRITE;
297 /*!40000 ALTER TABLE `Play` ENABLE KEYS */;
300 -- Table structure for table `Score`
303 DROP TABLE IF EXISTS `Score`;
304 CREATE TABLE `Score` (
305 `id` int(11) NOT NULL auto_increment,
306 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
307 `game_id` int(11) NOT NULL default '0',
308 `party` enum('re','contra') default NULL ,
309 `winner_id` int(11) default NULL ,
310 `looser_id` int(11) default NULL ,
311 `score` enum('120', 'call120','against120','90','call90','against90','made90',
312 '60','call60','against60','made60','30','call30','against30','made30',
313 '0','call0','against0','made0',
314 'fox','karlchen','dulle','doko','againstqueens') default NULL,
315 UNIQUE KEY `id` (`id`),
316 KEY `game_id` (`game_id`)
317 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
320 -- Dumping data for table `Score`
324 /*!40000 ALTER TABLE `Score` DISABLE KEYS */;
325 LOCK TABLES `Score` WRITE;
327 /*!40000 ALTER TABLE `Score` ENABLE KEYS */;
330 -- Table structure for table `Trick`
333 DROP TABLE IF EXISTS `Trick`;
334 CREATE TABLE `Trick` (
335 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
336 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
337 `id` int(11) NOT NULL auto_increment,
338 `game_id` int(11) NOT NULL default '0',
339 `winner` tinyint(4) default NULL,
340 UNIQUE KEY `id` (`id`),
341 KEY `game_id` (`game_id`)
342 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
345 -- Dumping data for table `Trick`
349 /*!40000 ALTER TABLE `Trick` DISABLE KEYS */;
350 LOCK TABLES `Trick` WRITE;
352 /*!40000 ALTER TABLE `Trick` ENABLE KEYS */;
355 -- Table structure for table `User`
358 DROP TABLE IF EXISTS `User`;
359 CREATE TABLE `User` (
360 `id` int(11) NOT NULL auto_increment,
361 `fullname` varchar(64) default NULL,
362 `email` varchar(64) default NULL,
363 `password` varchar(62) default NULL,
364 `timezone` varchar(64) default 'Europe/London',
365 `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
366 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
367 UNIQUE KEY `id` (`id`)
368 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
371 -- Dumping data for table `User`
375 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
376 LOCK TABLES `User` WRITE;
378 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
381 -- Table structure for table `User_Game_Prefs`
384 DROP TABLE IF EXISTS `User_Game_Prefs`;
385 CREATE TABLE `User_Game_Prefs` (
386 `id` int(11) NOT NULL auto_increment,
387 `user_id` int(11) NOT NULL default '0',
388 `game_id` int(11) NOT NULL default '0',
389 `pref_key` varchar(64) default NULL,
390 `value` varchar(64) default NULL,
391 UNIQUE KEY `id` (`id`),
392 KEY `user_id` (`user_id`)
393 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
396 -- Dumping data for table `User_Game_Prefs`
400 /*!40000 ALTER TABLE `User_Game_Prefs` DISABLE KEYS */;
401 LOCK TABLES `User_Game_Prefs` WRITE;
403 /*!40000 ALTER TABLE `User_Game_Prefs` ENABLE KEYS */;
406 -- Table structure for table `User_Prefs`
409 DROP TABLE IF EXISTS `User_Prefs`;
410 CREATE TABLE `User_Prefs` (
411 `id` int(11) NOT NULL auto_increment,
412 `user_id` int(11) NOT NULL default '0',
413 `pref_key` varchar(64) default NULL,
414 `value` varchar(64) default NULL,
415 UNIQUE KEY `id` (`id`),
416 KEY `user_id` (`user_id`)
417 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
420 -- Dumping data for table `User_Prefs`
426 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
427 LOCK TABLES `Recovery` WRITE;
429 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
432 DROP TABLE IF EXISTS `Recovery`;
433 CREATE TABLE `Recovery` (
434 `id` int(11) NOT NULL auto_increment,
435 `user_id` int(11) NOT NULL default '0',
436 `password` varchar(32) default NULL,
437 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
438 UNIQUE KEY `id` (`id`)
439 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
442 -- Dumping data for table `Recovery`
445 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
446 LOCK TABLES `Recovery` WRITE;
448 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
450 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
451 LOCK TABLES `Reminder` WRITE;
453 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
455 DROP TABLE IF EXISTS `Reminder`;
456 CREATE TABLE `Reminder` (
457 `id` int(11) NOT NULL auto_increment,
458 `user_id` int(11) NOT NULL default '0',
459 `game_id` int(11) NOT NULL default '0',
460 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
461 UNIQUE KEY `id` (`id`)
462 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
465 -- Dumping data for table `Reminder`
468 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
469 LOCK TABLES `Reminder` WRITE;
471 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
474 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
475 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
476 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
477 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
478 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
479 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
481 DROP TABLE IF EXISTS `user_openids`;
482 create table user_openids (
483 openid_url varchar(255) not null,
484 primary key (openid_url),
486 user_id int not null,
490 DROP TABLE IF EXISTS `digest_email`;
491 create table digest_email (
492 `id` int(11) NOT NULL auto_increment,
493 `email` varchar(255) default null,
494 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
495 `type` enum('misc','your_turn') NOT NULL default 'misc',
496 `game_id` int(11) default NULL,
498 UNIQUE KEY `id` (`id`),