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