CLEANUP: removed ereg-functions (deprecated in newer php versions)
[e-DoKo.git] / create_database.sql
1 /* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
2  *
3  *   This file is part of e-DoKo.
4  *
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.
9  *
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.
14  *
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/>.
17  *
18  */
19
20 -- MySQL dump 10.9
21 --
22 -- Host: localhost    Database: doko
23 -- ------------------------------------------------------
24 -- Server version       4.1.10
25
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' */;
33
34
35 --
36 -- Table structure for table `Version`
37 --
38
39 DROP TABLE IF EXISTS `Version`;
40 CREATE TABLE `Version` (
41   `version` int NOT NULL default '0'
42 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
43
44 --
45 -- Dumping data for table `Card`
46 --
47
48
49 /*!40000 ALTER TABLE `Card` DISABLE KEYS */;
50 LOCK TABLES `Version` WRITE;
51 INSERT INTO `Version` VALUES (1);
52 UNLOCK TABLES;
53 /*!40000 ALTER TABLE `Version` ENABLE KEYS */;
54
55
56 --
57 -- Table structure for table `Card`
58 --
59
60 DROP TABLE IF EXISTS `Card`;
61 CREATE TABLE `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;
68
69 --
70 -- Dumping data for table `Card`
71 --
72
73
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);
77 UNLOCK TABLES;
78 /*!40000 ALTER TABLE `Card` ENABLE KEYS */;
79
80 --
81 -- Table structure for table `Comment`
82 --
83
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   `comment` text,
92   UNIQUE KEY `id` (`id`),
93   KEY `play_id` (`play_id`)
94 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
95
96 --
97 -- Dumping data for table `Comment`
98 --
99
100
101 /*!40000 ALTER TABLE `Comment` DISABLE KEYS */;
102 LOCK TABLES `Comment` WRITE;
103 UNLOCK TABLES;
104 /*!40000 ALTER TABLE `Comment` ENABLE KEYS */;
105
106 --
107 -- Table structure for table `Notes`
108 --
109
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,
117   `comment` text,
118   UNIQUE KEY `id` (`id`)
119 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
120
121 --
122 -- Dumping data for table `Notes`
123 --
124
125 /*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
126 LOCK TABLES `Notes` WRITE;
127 UNLOCK TABLES;
128 /*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
129
130 --
131 -- Table structure for table `Game`
132 --
133
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;
151
152 --
153 -- Dumping data for table `Game`
154 --
155
156
157 /*!40000 ALTER TABLE `Game` DISABLE KEYS */;
158 LOCK TABLES `Game` WRITE;
159 UNLOCK TABLES;
160 /*!40000 ALTER TABLE `Game` ENABLE KEYS */;
161
162
163 --
164 -- Table structure for table `Ruleset`
165 --
166
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;
177
178 --
179 -- Dumping data for table `Rulesets`
180 --
181
182
183 /*!40000 ALTER TABLE `Rulesets` DISABLE KEYS */;
184 LOCK TABLES `Rulesets` WRITE;
185 UNLOCK TABLES;
186 /*!40000 ALTER TABLE `Rulesets` ENABLE KEYS */;
187
188
189
190 --
191 -- Table structure for table `Hand`
192 --
193
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;
210
211 --
212 -- Dumping data for table `Hand`
213 --
214
215
216 /*!40000 ALTER TABLE `Hand` DISABLE KEYS */;
217 LOCK TABLES `Hand` WRITE;
218 UNLOCK TABLES;
219 /*!40000 ALTER TABLE `Hand` ENABLE KEYS */;
220
221 --
222 -- Table structure for table `Hand_Card`
223 --
224
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;
234
235 --
236 -- Dumping data for table `Hand_Card`
237 --
238
239
240 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
241 LOCK TABLES `Hand_Card` WRITE;
242 UNLOCK TABLES;
243 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
244
245 --
246 -- Table structure for table `Card_Exchange`
247 --
248
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;
259
260 --
261 -- Dumping data for table `Hand_Card`
262 --
263
264
265 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
266 LOCK TABLES `Hand_Card` WRITE;
267 UNLOCK TABLES;
268 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
269
270
271 --
272 -- Table structure for table `Play`
273 --
274
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;
286
287 --
288 -- Dumping data for table `Play`
289 --
290
291
292 /*!40000 ALTER TABLE `Play` DISABLE KEYS */;
293 LOCK TABLES `Play` WRITE;
294 UNLOCK TABLES;
295 /*!40000 ALTER TABLE `Play` ENABLE KEYS */;
296
297 --
298 -- Table structure for table `Score`
299 --
300
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;
316
317 --
318 -- Dumping data for table `Score`
319 --
320
321
322 /*!40000 ALTER TABLE `Score` DISABLE KEYS */;
323 LOCK TABLES `Score` WRITE;
324 UNLOCK TABLES;
325 /*!40000 ALTER TABLE `Score` ENABLE KEYS */;
326
327 --
328 -- Table structure for table `Trick`
329 --
330
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;
341
342 --
343 -- Dumping data for table `Trick`
344 --
345
346
347 /*!40000 ALTER TABLE `Trick` DISABLE KEYS */;
348 LOCK TABLES `Trick` WRITE;
349 UNLOCK TABLES;
350 /*!40000 ALTER TABLE `Trick` ENABLE KEYS */;
351
352 --
353 -- Table structure for table `User`
354 --
355
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;
367
368 --
369 -- Dumping data for table `User`
370 --
371
372
373 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
374 LOCK TABLES `User` WRITE;
375 UNLOCK TABLES;
376 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
377
378 --
379 -- Table structure for table `User_Game_Prefs`
380 --
381
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;
392
393 --
394 -- Dumping data for table `User_Game_Prefs`
395 --
396
397
398 /*!40000 ALTER TABLE `User_Game_Prefs` DISABLE KEYS */;
399 LOCK TABLES `User_Game_Prefs` WRITE;
400 UNLOCK TABLES;
401 /*!40000 ALTER TABLE `User_Game_Prefs` ENABLE KEYS */;
402
403 --
404 -- Table structure for table `User_Prefs`
405 --
406
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;
416
417 --
418 -- Dumping data for table `User_Prefs`
419 --
420
421
422
423
424 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
425 LOCK TABLES `Recovery` WRITE;
426 UNLOCK TABLES;
427 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
428
429
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;
438
439 --
440 -- Dumping data for table `Recovery`
441 --
442
443 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
444 LOCK TABLES `Recovery` WRITE;
445 UNLOCK TABLES;
446 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
447
448 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
449 LOCK TABLES `Reminder` WRITE;
450 UNLOCK TABLES;
451 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
452
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;
461
462 --
463 -- Dumping data for table `Reminder`
464 --
465
466 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
467 LOCK TABLES `Reminder` WRITE;
468 UNLOCK TABLES;
469 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
470
471
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 */;
478
479 DROP TABLE IF EXISTS `user_openids`;
480 create table user_openids (
481   openid_url varchar(255) not null,
482   primary key (openid_url),
483
484   user_id int not null,
485   index (user_id)
486 );
487
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',
493   `content` text,
494   UNIQUE KEY `id` (`id`),
495   index (email)
496 );
497
498