339c3371d30f07d0d1efdb03a95635120f38feed
[e-DoKo.git] / create_database.sql
1 -- MySQL dump 10.9
2 --
3 -- Host: localhost    Database: doko
4 -- ------------------------------------------------------
5 -- Server version       4.1.10
6
7 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 /*!40101 SET NAMES utf8 */;
11 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
12 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
13 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
14
15
16 --
17 -- Table structure for table `Version`
18 --
19
20 DROP TABLE IF EXISTS `Version`;
21 CREATE TABLE `Version` (
22   `version` int NOT NULL default '0'
23 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
24
25 --
26 -- Dumping data for table `Card`
27 --
28
29
30 /*!40000 ALTER TABLE `Card` DISABLE KEYS */;
31 LOCK TABLES `Version` WRITE;
32 INSERT INTO `Version` VALUES (1);
33 UNLOCK TABLES;
34 /*!40000 ALTER TABLE `Version` ENABLE KEYS */;
35
36
37 --
38 -- Table structure for table `Card`
39 --
40
41 DROP TABLE IF EXISTS `Card`;
42 CREATE TABLE `Card` (
43   `id` int(11) NOT NULL auto_increment,
44   `suite` enum('diamonds','hearts','spades','clubs') NOT NULL default 'diamonds',
45   `strength` enum('nine','ten','jack','queen','king','ace') NOT NULL default 'nine',
46   `points` tinyint(4) NOT NULL default '0',
47   UNIQUE KEY `id` (`id`)
48 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
49
50 --
51 -- Dumping data for table `Card`
52 --
53
54
55 /*!40000 ALTER TABLE `Card` DISABLE KEYS */;
56 LOCK TABLES `Card` WRITE;
57 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);
58 UNLOCK TABLES;
59 /*!40000 ALTER TABLE `Card` ENABLE KEYS */;
60
61 --
62 -- Table structure for table `Comment`
63 --
64
65 DROP TABLE IF EXISTS `Comment`;
66 CREATE TABLE `Comment` (
67   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
68   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
69   `id` int(11) NOT NULL auto_increment,
70   `user_id` int(11) default NULL,
71   `play_id` int(11) default NULL,
72   `comment` text,
73   UNIQUE KEY `id` (`id`),
74   KEY `play_id` (`play_id`)
75 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
76
77 --
78 -- Dumping data for table `Comment`
79 --
80
81
82 /*!40000 ALTER TABLE `Comment` DISABLE KEYS */;
83 LOCK TABLES `Comment` WRITE;
84 UNLOCK TABLES;
85 /*!40000 ALTER TABLE `Comment` ENABLE KEYS */;
86
87 --
88 -- Table structure for table `Notes`
89 --
90
91 DROP TABLE IF EXISTS `Notes`;
92 CREATE TABLE `Notes` (
93   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
94   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
95   `id` int(11) NOT NULL auto_increment,
96   `user_id` int(11) default NULL,
97   `game_id` int(11) default NULL,
98   `comment` text,
99   UNIQUE KEY `id` (`id`)
100 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
101
102 --
103 -- Dumping data for table `Notes`
104 --
105
106 /*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
107 LOCK TABLES `Notes` WRITE;
108 UNLOCK TABLES;
109 /*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
110
111 --
112 -- Table structure for table `Game`
113 --
114
115 DROP TABLE IF EXISTS `Game`;
116 CREATE TABLE `Game` (
117   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
118   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
119   `randomnumbers` varchar(136) default NULL,
120   `type` enum('normal','solo','wedding','poverty','dpoverty') default NULL,
121   `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
122   `sickness` int(11) default NULL,
123   `startplayer` tinyint(4) default '1',
124   `player` int(11) default NULL,
125   `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay') default NULL,
126   `ruleset` int(11) default NULL,
127   `session` int(11) default NULL,
128   `id` int(11) NOT NULL auto_increment,
129   UNIQUE KEY `id` (`id`),
130   KEY `session` (`session`)
131 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
132
133 --
134 -- Dumping data for table `Game`
135 --
136
137
138 /*!40000 ALTER TABLE `Game` DISABLE KEYS */;
139 LOCK TABLES `Game` WRITE;
140 UNLOCK TABLES;
141 /*!40000 ALTER TABLE `Game` ENABLE KEYS */;
142
143
144 --
145 -- Table structure for table `Ruleset`
146 --
147
148 DROP TABLE IF EXISTS `Rulesets`;
149 CREATE TABLE `Rulesets` (
150   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
151   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
152   `dullen` enum('none','firstwins','secondwins') default 'secondwins',
153   `schweinchen` enum ('none','both','second','secondaftercall') default 'second',
154   `call` enum ('1st-own-card','5th-card','9-cards') default '1st-own-card',
155   `id` int(11) NOT NULL auto_increment,
156   UNIQUE KEY `id` (`id`)
157 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
158
159 --
160 -- Dumping data for table `Rulesets`
161 --
162
163
164 /*!40000 ALTER TABLE `Rulesets` DISABLE KEYS */;
165 LOCK TABLES `Rulesets` WRITE;
166 UNLOCK TABLES;
167 /*!40000 ALTER TABLE `Rulesets` ENABLE KEYS */;
168
169
170
171 --
172 -- Table structure for table `Hand`
173 --
174
175 DROP TABLE IF EXISTS `Hand`;
176 CREATE TABLE `Hand` (
177   `id` int(11) NOT NULL auto_increment,
178   `game_id` int(11) NOT NULL default '0',
179   `user_id` int(11) NOT NULL default '0',
180   `hash` varchar(33) default NULL,
181   `status` enum('start','init','check','poverty','play','gameover') default 'start',
182   `position` tinyint(4) NOT NULL default '0',
183   `party` enum('re','contra') default NULL,
184   `sickness` enum('wedding','nines','poverty','solo') default NULL,
185   `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
186   `point_call` enum('120','90','60','30','0') default NULL,
187   UNIQUE KEY `id` (`id`),
188   KEY `game_id` (`game_id`),
189   KEY `user_id` (`user_id`)
190 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
191
192 --
193 -- Dumping data for table `Hand`
194 --
195
196
197 /*!40000 ALTER TABLE `Hand` DISABLE KEYS */;
198 LOCK TABLES `Hand` WRITE;
199 UNLOCK TABLES;
200 /*!40000 ALTER TABLE `Hand` ENABLE KEYS */;
201
202 --
203 -- Table structure for table `Hand_Card`
204 --
205
206 DROP TABLE IF EXISTS `Hand_Card`;
207 CREATE TABLE `Hand_Card` (
208   `id` int(11) NOT NULL auto_increment,
209   `hand_id` int(11) NOT NULL default '0',
210   `card_id` int(11) NOT NULL default '0',
211   `played` enum('true','false') default 'false',
212   UNIQUE KEY `id` (`id`),
213   KEY `hand_id` (`hand_id`)
214 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
215
216 --
217 -- Dumping data for table `Hand_Card`
218 --
219
220
221 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
222 LOCK TABLES `Hand_Card` WRITE;
223 UNLOCK TABLES;
224 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
225
226 --
227 -- Table structure for table `Card_Exchange`
228 --
229
230 DROP TABLE IF EXISTS `Card_Exchange`;
231 CREATE TABLE `Card_Exchange` (
232   `id` int(11) NOT NULL auto_increment,
233   `orig_hand_id` int(11) NOT NULL default '0',
234   `new_hand_id` int(11) NOT NULL default '0',
235   `card_id` int(11) NOT NULL default '0',
236   UNIQUE KEY `id` (`id`),
237   KEY `orig_hand_id` (`orig_hand_id`),
238   KEY `new_hand_id` (`new_hand_id`)
239 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
240
241 --
242 -- Dumping data for table `Hand_Card`
243 --
244
245
246 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
247 LOCK TABLES `Hand_Card` WRITE;
248 UNLOCK TABLES;
249 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
250
251
252 --
253 -- Table structure for table `Play`
254 --
255
256 DROP TABLE IF EXISTS `Play`;
257 CREATE TABLE `Play` (
258   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
259   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
260   `id` int(11) NOT NULL auto_increment,
261   `trick_id` int(11) NOT NULL default '0',
262   `hand_card_id` int(11) NOT NULL default '0',
263   `sequence` tinyint(4) NOT NULL default '0',
264   UNIQUE KEY `id` (`id`),
265   KEY `trick_id` (`trick_id`)
266 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
267
268 --
269 -- Dumping data for table `Play`
270 --
271
272
273 /*!40000 ALTER TABLE `Play` DISABLE KEYS */;
274 LOCK TABLES `Play` WRITE;
275 UNLOCK TABLES;
276 /*!40000 ALTER TABLE `Play` ENABLE KEYS */;
277
278 --
279 -- Table structure for table `Score`
280 --
281
282 DROP TABLE IF EXISTS `Score`;
283 CREATE TABLE `Score` (
284   `id` int(11) NOT NULL auto_increment,
285   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
286   `game_id` int(11) NOT NULL default '0',
287   `party` enum('re','contra') default NULL ,
288   `winner_id` int(11) default NULL ,
289   `looser_id` int(11) default NULL ,
290   `score` enum('120', 'call120','against120','90','call90','against90','made90',
291           '60','call60','against60','made60','30','call30','against30','made30',
292           '0','call0','against0','made0',
293           'fox','karlchen','dulle','doko','againstqueens') default NULL,
294   UNIQUE KEY `id` (`id`),
295   KEY `game_id` (`game_id`)
296 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
297
298 --
299 -- Dumping data for table `Score`
300 --
301
302
303 /*!40000 ALTER TABLE `Score` DISABLE KEYS */;
304 LOCK TABLES `Score` WRITE;
305 UNLOCK TABLES;
306 /*!40000 ALTER TABLE `Score` ENABLE KEYS */;
307
308 --
309 -- Table structure for table `Trick`
310 --
311
312 DROP TABLE IF EXISTS `Trick`;
313 CREATE TABLE `Trick` (
314   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
315   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
316   `id` int(11) NOT NULL auto_increment,
317   `game_id` int(11) NOT NULL default '0',
318   `winner`  tinyint(4) default NULL,
319   UNIQUE KEY `id` (`id`),
320   KEY `game_id` (`game_id`)
321 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
322
323 --
324 -- Dumping data for table `Trick`
325 --
326
327
328 /*!40000 ALTER TABLE `Trick` DISABLE KEYS */;
329 LOCK TABLES `Trick` WRITE;
330 UNLOCK TABLES;
331 /*!40000 ALTER TABLE `Trick` ENABLE KEYS */;
332
333 --
334 -- Table structure for table `User`
335 --
336
337 DROP TABLE IF EXISTS `User`;
338 CREATE TABLE `User` (
339   `id` int(11) NOT NULL auto_increment,
340   `fullname` varchar(64) default NULL,
341   `email` varchar(64) default NULL,
342   `password` varchar(32) default NULL,
343   `timezone` varchar(64) default 'Europe/London',
344   `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
345   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
346   UNIQUE KEY `id` (`id`)
347 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
348
349 --
350 -- Dumping data for table `User`
351 --
352
353
354 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
355 LOCK TABLES `User` WRITE;
356 UNLOCK TABLES;
357 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
358
359 --
360 -- Table structure for table `User_Game_Prefs`
361 --
362
363 DROP TABLE IF EXISTS `User_Game_Prefs`;
364 CREATE TABLE `User_Game_Prefs` (
365   `id` int(11) NOT NULL auto_increment,
366   `user_id` int(11) NOT NULL default '0',
367   `game_id` int(11) NOT NULL default '0',
368   `pref_key` varchar(64) default NULL,
369   `value` varchar(64) default NULL,
370   UNIQUE KEY `id` (`id`),
371   KEY `user_id` (`user_id`)
372 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
373
374 --
375 -- Dumping data for table `User_Game_Prefs`
376 --
377
378
379 /*!40000 ALTER TABLE `User_Game_Prefs` DISABLE KEYS */;
380 LOCK TABLES `User_Game_Prefs` WRITE;
381 UNLOCK TABLES;
382 /*!40000 ALTER TABLE `User_Game_Prefs` ENABLE KEYS */;
383
384 --
385 -- Table structure for table `User_Prefs`
386 --
387
388 DROP TABLE IF EXISTS `User_Prefs`;
389 CREATE TABLE `User_Prefs` (
390   `id` int(11) NOT NULL auto_increment,
391   `user_id` int(11) NOT NULL default '0',
392   `pref_key` varchar(64) default NULL,
393   `value` varchar(64) default NULL,
394   UNIQUE KEY `id` (`id`),
395   KEY `user_id` (`user_id`)
396 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
397
398 --
399 -- Dumping data for table `User_Prefs`
400 --
401
402
403
404
405 /*!40000 ALTER TABLE `Recovery` DISABLE KEYS */;
406 LOCK TABLES `Recovery` WRITE;
407 UNLOCK TABLES;
408 /*!40000 ALTER TABLE `Recovery` ENABLE KEYS */;
409
410
411 DROP TABLE IF EXISTS `Recovery`;
412 CREATE TABLE `Recovery` (
413   `id` int(11) NOT NULL auto_increment,
414   `user_id` int(11) NOT NULL default '0',
415   `password` varchar(32) default NULL,
416   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
417   UNIQUE KEY `id` (`id`)
418 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
419
420 --
421 -- Dumping data for table `Recovery`
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 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
430 LOCK TABLES `Reminder` WRITE;
431 UNLOCK TABLES;
432 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
433
434 DROP TABLE IF EXISTS `Reminder`;
435 CREATE TABLE `Reminder` (
436   `id` int(11) NOT NULL auto_increment,
437   `user_id` int(11) NOT NULL default '0',
438   `game_id` int(11) NOT NULL default '0',
439   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
440   UNIQUE KEY `id` (`id`)
441 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
442
443 --
444 -- Dumping data for table `Reminder`
445 --
446
447 /*!40000 ALTER TABLE `Reminder` DISABLE KEYS */;
448 LOCK TABLES `Reminder` WRITE;
449 UNLOCK TABLES;
450 /*!40000 ALTER TABLE `Reminder` ENABLE KEYS */;
451
452
453 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
454 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
455 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
456 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
457 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
458 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
459
460 DROP TABLE IF EXISTS `user_openids`;
461 create table user_openids (
462   openid_url varchar(255) not null,
463   primary key (openid_url),
464
465   user_id int not null,
466   index (user_id)
467 );