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