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 (1);
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') 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 `id` int(11) NOT NULL auto_increment,
175 UNIQUE KEY `id` (`id`)
176 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
179 -- Dumping data for table `Rulesets`
183 /*!40000 ALTER TABLE `Rulesets` DISABLE KEYS */;
184 LOCK TABLES `Rulesets` WRITE;
186 /*!40000 ALTER TABLE `Rulesets` ENABLE KEYS */;
191 -- Table structure for table `Hand`
194 DROP TABLE IF EXISTS `Hand`;
195 CREATE TABLE `Hand` (
196 `id` int(11) NOT NULL auto_increment,
197 `game_id` int(11) NOT NULL default '0',
198 `user_id` int(11) NOT NULL default '0',
199 `hash` varchar(33) default NULL,
200 `status` enum('start','init','check','poverty','play','gameover') default 'start',
201 `position` tinyint(4) NOT NULL default '0',
202 `party` enum('re','contra') default NULL,
203 `sickness` enum('wedding','nines','poverty','solo') default NULL,
204 `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
205 `point_call` enum('120','90','60','30','0') default NULL,
206 UNIQUE KEY `id` (`id`),
207 KEY `game_id` (`game_id`),
208 KEY `user_id` (`user_id`)
209 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
212 -- Dumping data for table `Hand`
216 /*!40000 ALTER TABLE `Hand` DISABLE KEYS */;
217 LOCK TABLES `Hand` WRITE;
219 /*!40000 ALTER TABLE `Hand` ENABLE KEYS */;
222 -- Table structure for table `Hand_Card`
225 DROP TABLE IF EXISTS `Hand_Card`;
226 CREATE TABLE `Hand_Card` (
227 `id` int(11) NOT NULL auto_increment,
228 `hand_id` int(11) NOT NULL default '0',
229 `card_id` int(11) NOT NULL default '0',
230 `played` enum('true','false') default 'false',
231 UNIQUE KEY `id` (`id`),
232 KEY `hand_id` (`hand_id`)
233 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
236 -- Dumping data for table `Hand_Card`
240 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
241 LOCK TABLES `Hand_Card` WRITE;
243 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
246 -- Table structure for table `Card_Exchange`
249 DROP TABLE IF EXISTS `Card_Exchange`;
250 CREATE TABLE `Card_Exchange` (
251 `id` int(11) NOT NULL auto_increment,
252 `orig_hand_id` int(11) NOT NULL default '0',
253 `new_hand_id` int(11) NOT NULL default '0',
254 `card_id` int(11) NOT NULL default '0',
255 UNIQUE KEY `id` (`id`),
256 KEY `orig_hand_id` (`orig_hand_id`),
257 KEY `new_hand_id` (`new_hand_id`)
258 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
261 -- Dumping data for table `Hand_Card`
265 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
266 LOCK TABLES `Card_Exchange` WRITE;
268 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
272 -- Table structure for table `Play`
275 DROP TABLE IF EXISTS `Play`;
276 CREATE TABLE `Play` (
277 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
278 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
279 `id` int(11) NOT NULL auto_increment,
280 `trick_id` int(11) NOT NULL default '0',
281 `hand_card_id` int(11) NOT NULL default '0',
282 `sequence` tinyint(4) NOT NULL default '0',
283 UNIQUE KEY `id` (`id`),
284 KEY `trick_id` (`trick_id`)
285 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
288 -- Dumping data for table `Play`
292 /*!40000 ALTER TABLE `Play` DISABLE KEYS */;
293 LOCK TABLES `Play` WRITE;
295 /*!40000 ALTER TABLE `Play` ENABLE KEYS */;
298 -- Table structure for table `Score`
301 DROP TABLE IF EXISTS `Score`;
302 CREATE TABLE `Score` (
303 `id` int(11) NOT NULL auto_increment,
304 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
305 `game_id` int(11) NOT NULL default '0',
306 `party` enum('re','contra') default NULL ,
307 `winner_id` int(11) default NULL ,
308 `looser_id` int(11) default NULL ,
309 `score` enum('120', 'call120','against120','90','call90','against90','made90',
310 '60','call60','against60','made60','30','call30','against30','made30',
311 '0','call0','against0','made0',
312 'fox','karlchen','dulle','doko','againstqueens') default NULL,
313 UNIQUE KEY `id` (`id`),
314 KEY `game_id` (`game_id`)
315 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
318 -- Dumping data for table `Score`
322 /*!40000 ALTER TABLE `Score` DISABLE KEYS */;
323 LOCK TABLES `Score` WRITE;
325 /*!40000 ALTER TABLE `Score` ENABLE KEYS */;
328 -- Table structure for table `Trick`
331 DROP TABLE IF EXISTS `Trick`;
332 CREATE TABLE `Trick` (
333 `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
334 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
335 `id` int(11) NOT NULL auto_increment,
336 `game_id` int(11) NOT NULL default '0',
337 `winner` tinyint(4) default NULL,
338 UNIQUE KEY `id` (`id`),
339 KEY `game_id` (`game_id`)
340 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
343 -- Dumping data for table `Trick`
347 /*!40000 ALTER TABLE `Trick` DISABLE KEYS */;
348 LOCK TABLES `Trick` WRITE;
350 /*!40000 ALTER TABLE `Trick` ENABLE KEYS */;
353 -- Table structure for table `User`
356 DROP TABLE IF EXISTS `User`;
357 CREATE TABLE `User` (
358 `id` int(11) NOT NULL auto_increment,
359 `fullname` varchar(64) default NULL,
360 `email` varchar(64) default NULL,
361 `password` varchar(32) default NULL,
362 `timezone` varchar(64) default 'Europe/London',
363 `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
364 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
365 UNIQUE KEY `id` (`id`)
366 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
369 -- Dumping data for table `User`
373 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
374 LOCK TABLES `User` WRITE;
376 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
379 -- Table structure for table `User_Game_Prefs`
382 DROP TABLE IF EXISTS `User_Game_Prefs`;
383 CREATE TABLE `User_Game_Prefs` (
384 `id` int(11) NOT NULL auto_increment,
385 `user_id` int(11) NOT NULL default '0',
386 `game_id` int(11) NOT NULL default '0',
387 `pref_key` varchar(64) default NULL,
388 `value` varchar(64) default NULL,
389 UNIQUE KEY `id` (`id`),
390 KEY `user_id` (`user_id`)
391 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
394 -- Dumping data for table `User_Game_Prefs`
398 /*!40000 ALTER TABLE `User_Game_Prefs` DISABLE KEYS */;
399 LOCK TABLES `User_Game_Prefs` WRITE;
401 /*!40000 ALTER TABLE `User_Game_Prefs` ENABLE KEYS */;
404 -- Table structure for table `User_Prefs`
407 DROP TABLE IF EXISTS `User_Prefs`;
408 CREATE TABLE `User_Prefs` (
409 `id` int(11) NOT NULL auto_increment,
410 `user_id` int(11) NOT NULL default '0',
411 `pref_key` varchar(64) default NULL,
412 `value` varchar(64) default NULL,
413 UNIQUE KEY `id` (`id`),
414 KEY `user_id` (`user_id`)
415 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
418 -- Dumping data for table `User_Prefs`
424 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
425 LOCK TABLES `Recovery` WRITE;
427 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
430 DROP TABLE IF EXISTS `Recovery`;
431 CREATE TABLE `Recovery` (
432 `id` int(11) NOT NULL auto_increment,
433 `user_id` int(11) NOT NULL default '0',
434 `password` varchar(32) default NULL,
435 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
436 UNIQUE KEY `id` (`id`)
437 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
440 -- Dumping data for table `Recovery`
443 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
444 LOCK TABLES `Recovery` WRITE;
446 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
448 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
449 LOCK TABLES `Reminder` WRITE;
451 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
453 DROP TABLE IF EXISTS `Reminder`;
454 CREATE TABLE `Reminder` (
455 `id` int(11) NOT NULL auto_increment,
456 `user_id` int(11) NOT NULL default '0',
457 `game_id` int(11) NOT NULL default '0',
458 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
459 UNIQUE KEY `id` (`id`)
460 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
463 -- Dumping data for table `Reminder`
466 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
467 LOCK TABLES `Reminder` WRITE;
469 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
472 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
473 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
474 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
475 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
476 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
477 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
479 DROP TABLE IF EXISTS `user_openids`;
480 create table user_openids (
481 openid_url varchar(255) not null,
482 primary key (openid_url),
484 user_id int not null,
488 DROP TABLE IF EXISTS `digest_email`;
489 create table digest_email (
490 `id` int(11) NOT NULL auto_increment,
491 `email` varchar(255) default null,
492 `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
494 UNIQUE KEY `id` (`id`),