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