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