small fixes, typo, etc
[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   `status` enum('pre','play','gameover') default NULL,
78   `ruleset` int(11) default NULL,
79   `session` int(11) default NULL,
80   `id` int(11) NOT NULL auto_increment,
81   UNIQUE KEY `id` (`id`)
82 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
83
84 --
85 -- Dumping data for table `Game`
86 --
87
88
89 /*!40000 ALTER TABLE `Game` DISABLE KEYS */;
90 LOCK TABLES `Game` WRITE;
91 UNLOCK TABLES;
92 /*!40000 ALTER TABLE `Game` ENABLE KEYS */;
93
94
95 --
96 -- Table structure for table `Ruleset`
97 --
98
99 DROP TABLE IF EXISTS `Rulesets`;
100 CREATE TABLE `Rulesets` (
101   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
102   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
103   `dullen` enum('none','firstwins','secondwins') default 'secondwins',
104   `schweinchen` enum ('none','both','second','secondaftercall') default 'second',
105   `id` int(11) NOT NULL auto_increment,
106   UNIQUE KEY `id` (`id`)
107 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
108   
109 --
110 -- Dumping data for table `Rulesets`
111 --
112
113
114 /*!40000 ALTER TABLE `Rulesets` DISABLE KEYS */;
115 LOCK TABLES `Rulesets` WRITE;
116 UNLOCK TABLES;
117 /*!40000 ALTER TABLE `Rulesets` ENABLE KEYS */;
118
119
120
121 --
122 -- Table structure for table `Hand`
123 --
124
125 DROP TABLE IF EXISTS `Hand`;
126 CREATE TABLE `Hand` (
127   `id` int(11) NOT NULL auto_increment,
128   `game_id` int(11) NOT NULL default '0',
129   `user_id` int(11) NOT NULL default '0',
130   `hash` varchar(33) default NULL,
131   `status` enum('start','init','check','poverty','play','gameover') default 'start',
132   `position` tinyint(4) NOT NULL default '0',
133   `party` enum('re','contra') default NULL,
134   `sickness` enum('wedding','nines','poverty','solo') default NULL,
135   `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL,
136   `point_call` enum('120','90','60','30','0') default NULL,
137   UNIQUE KEY `id` (`id`)
138 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
139
140 --
141 -- Dumping data for table `Hand`
142 --
143
144
145 /*!40000 ALTER TABLE `Hand` DISABLE KEYS */;
146 LOCK TABLES `Hand` WRITE;
147 UNLOCK TABLES;
148 /*!40000 ALTER TABLE `Hand` ENABLE KEYS */;
149
150 --
151 -- Table structure for table `Hand_Card`
152 --
153
154 DROP TABLE IF EXISTS `Hand_Card`;
155 CREATE TABLE `Hand_Card` (
156   `id` int(11) NOT NULL auto_increment,
157   `hand_id` int(11) NOT NULL default '0',
158   `card_id` int(11) NOT NULL default '0',
159   `played` enum('true','false') default 'false',
160   UNIQUE KEY `id` (`id`)
161 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
162
163 --
164 -- Dumping data for table `Hand_Card`
165 --
166
167
168 /*!40000 ALTER TABLE `Hand_Card` DISABLE KEYS */;
169 LOCK TABLES `Hand_Card` WRITE;
170 UNLOCK TABLES;
171 /*!40000 ALTER TABLE `Hand_Card` ENABLE KEYS */;
172
173 --
174 -- Table structure for table `Play`
175 --
176
177 DROP TABLE IF EXISTS `Play`;
178 CREATE TABLE `Play` (
179   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
180   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
181   `id` int(11) NOT NULL auto_increment,
182   `trick_id` int(11) NOT NULL default '0',
183   `hand_card_id` int(11) NOT NULL default '0',
184   `sequence` tinyint(4) NOT NULL default '0',
185   UNIQUE KEY `id` (`id`)
186 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
187
188 --
189 -- Dumping data for table `Play`
190 --
191
192
193 /*!40000 ALTER TABLE `Play` DISABLE KEYS */;
194 LOCK TABLES `Play` WRITE;
195 UNLOCK TABLES;
196 /*!40000 ALTER TABLE `Play` ENABLE KEYS */;
197
198 --
199 -- Table structure for table `Score`
200 --
201
202 DROP TABLE IF EXISTS `Score`;
203 CREATE TABLE `Score` (
204   `id` int(11) NOT NULL auto_increment,
205   `game_id` int(11) NOT NULL default '0',
206   `hand_id` int(11) NOT NULL default '0',
207   `score` tinyint(4) default NULL,
208   UNIQUE KEY `id` (`id`)
209 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
210
211 --
212 -- Dumping data for table `Score`
213 --
214
215
216 /*!40000 ALTER TABLE `Score` DISABLE KEYS */;
217 LOCK TABLES `Score` WRITE;
218 UNLOCK TABLES;
219 /*!40000 ALTER TABLE `Score` ENABLE KEYS */;
220
221 --
222 -- Table structure for table `Trick`
223 --
224
225 DROP TABLE IF EXISTS `Trick`;
226 CREATE TABLE `Trick` (
227   `mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
228   `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
229   `id` int(11) NOT NULL auto_increment,
230   `game_id` int(11) NOT NULL default '0',
231   UNIQUE KEY `id` (`id`)
232 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
233
234 --
235 -- Dumping data for table `Trick`
236 --
237
238
239 /*!40000 ALTER TABLE `Trick` DISABLE KEYS */;
240 LOCK TABLES `Trick` WRITE;
241 UNLOCK TABLES;
242 /*!40000 ALTER TABLE `Trick` ENABLE KEYS */;
243
244 --
245 -- Table structure for table `User`
246 --
247
248 DROP TABLE IF EXISTS `User`;
249 CREATE TABLE `User` (
250   `id` int(11) NOT NULL auto_increment,
251   `fullname` varchar(64) default NULL,
252   `email` varchar(64) default NULL,
253   `password` varchar(32) default NULL,
254   `timezone` tinyint(2) default NULL,
255   `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
256   UNIQUE KEY `id` (`id`)
257 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
258
259 --
260 -- Dumping data for table `User`
261 --
262
263
264 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
265 LOCK TABLES `User` WRITE;
266 UNLOCK TABLES;
267 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
268
269 --
270 -- Table structure for table `User_Game_Prefs`
271 --
272
273 DROP TABLE IF EXISTS `User_Game_Prefs`;
274 CREATE TABLE `User_Game_Prefs` (
275   `id` int(11) NOT NULL auto_increment,
276   `user_id` int(11) NOT NULL default '0',
277   `game_id` int(11) NOT NULL default '0',
278   `pref_key` varchar(64) default NULL,
279   `value` varchar(64) default NULL,
280   UNIQUE KEY `id` (`id`)
281 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
282
283 --
284 -- Dumping data for table `User_Game_Prefs`
285 --
286
287
288 /*!40000 ALTER TABLE `User_Game_Prefs` DISABLE KEYS */;
289 LOCK TABLES `User_Game_Prefs` WRITE;
290 UNLOCK TABLES;
291 /*!40000 ALTER TABLE `User_Game_Prefs` ENABLE KEYS */;
292
293 --
294 -- Table structure for table `User_Prefs`
295 --
296
297 DROP TABLE IF EXISTS `User_Prefs`;
298 CREATE TABLE `User_Prefs` (
299   `id` int(11) NOT NULL auto_increment,
300   `user_id` int(11) NOT NULL default '0',
301   `pref_key` varchar(64) default NULL,
302   `value` varchar(64) default NULL,
303   UNIQUE KEY `id` (`id`)
304 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
305
306 --
307 -- Dumping data for table `User_Prefs`
308 --
309
310
311 /*!40000 ALTER TABLE `User_Prefs` DISABLE KEYS */;
312 LOCK TABLES `User_Prefs` WRITE;
313 UNLOCK TABLES;
314 /*!40000 ALTER TABLE `User_Prefs` ENABLE KEYS */;
315
316 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
317 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
318 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
319 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
320 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
321 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
322