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