SQL dump - InnoDB, foreign keys
[mirrors/SokoMan.git] / install.sql
1 -- MySQL dump 10.11
2 --
3 -- Host: localhost Database: sklad
4 -- ------------------------------------------------------
5 -- Server version 5.0.51a-24+lenny5
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 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 /*!40103 SET TIME_ZONE='+00:00' */;
13 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
18 --
19 -- Table structure for table `category`
20 --
21
22 DROP TABLE IF EXISTS `category`;
23 SET @saved_cs_client = @@character_set_client;
24 SET character_set_client = utf8;
25 CREATE TABLE `category` (
26 `category_id` int(11) NOT NULL auto_increment,
27 `category_name` varchar(64) collate utf8_czech_ci NOT NULL,
28 PRIMARY KEY (`category_id`),
29 UNIQUE KEY `category_name` (`category_name`)
30 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
31 SET character_set_client = @saved_cs_client;
32
33 --
34 -- Dumping data for table `category`
35 --
36
37 LOCK TABLES `category` WRITE;
38 /*!40000 ALTER TABLE `category` DISABLE KEYS */;
39 INSERT INTO `category` VALUES (1,'picovinky'),(2,'Tezka technika, Traktory, etc..');
40 /*!40000 ALTER TABLE `category` ENABLE KEYS */;
41 UNLOCK TABLES;
42
43 --
44 -- Table structure for table `item`
45 --
46
47 DROP TABLE IF EXISTS `item`;
48 SET @saved_cs_client = @@character_set_client;
49 SET character_set_client = utf8;
50 CREATE TABLE `item` (
51 `item_id` int(11) NOT NULL auto_increment,
52 `model_id` int(11) NOT NULL,
53 `vendor_id` int(11) NOT NULL,
54 `item_serial` varchar(128) collate utf8_czech_ci NOT NULL,
55 `item_quantity` int(11) default NULL,
56 `room_id` int(11) NOT NULL default '0',
57 `status_id` int(11) NOT NULL default '0',
58 `item_price_in` decimal(9,2) NOT NULL default '0.00',
59 `item_price_out` decimal(9,2) default NULL,
60 PRIMARY KEY (`item_id`),
61 UNIQUE KEY `item_serial` (`item_serial`),
62 KEY `vendor_id` (`vendor_id`),
63 KEY `model_id` (`model_id`),
64 KEY `status_id` (`status_id`),
65 KEY `room_id` (`room_id`),
66 CONSTRAINT `item_ibfk_6` FOREIGN KEY (`vendor_id`) REFERENCES `vendor` (`vendor_id`),
67 CONSTRAINT `item_ibfk_7` FOREIGN KEY (`model_id`) REFERENCES `model` (`model_id`),
68 CONSTRAINT `item_ibfk_8` FOREIGN KEY (`status_id`) REFERENCES `status` (`status_id`),
69 CONSTRAINT `item_ibfk_9` FOREIGN KEY (`room_id`) REFERENCES `room` (`room_id`)
70 ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
71 SET character_set_client = @saved_cs_client;
72
73 --
74 -- Dumping data for table `item`
75 --
76
77 LOCK TABLES `item` WRITE;
78 /*!40000 ALTER TABLE `item` DISABLE KEYS */;
79 INSERT INTO `item` VALUES (9,3,2,'SATAN',0,1,1,'0.10','0.00'),(20,3,1,'editmeeeee',23,1,1,'0.00','0.00'),(22,1,1,'ahoj',42,1,1,'1.00','2.00');
80 /*!40000 ALTER TABLE `item` ENABLE KEYS */;
81 UNLOCK TABLES;
82
83 --
84 -- Table structure for table `model`
85 --
86
87 DROP TABLE IF EXISTS `model`;
88 SET @saved_cs_client = @@character_set_client;
89 SET character_set_client = utf8;
90 CREATE TABLE `model` (
91 `model_id` int(11) NOT NULL auto_increment,
92 `model_name` varchar(64) collate utf8_czech_ci NOT NULL,
93 `producer_id` int(11) NOT NULL default '0',
94 `category_id` int(11) NOT NULL default '0',
95 `model_barcode` varchar(128) collate utf8_czech_ci NOT NULL,
96 `model_price_out` decimal(9,2) default NULL,
97 `model_descript` varchar(1024) collate utf8_czech_ci NOT NULL,
98 PRIMARY KEY (`model_id`),
99 UNIQUE KEY `model_barcode` (`model_barcode`),
100 KEY `category_id` (`category_id`),
101 KEY `producer_id` (`producer_id`),
102 CONSTRAINT `model_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`),
103 CONSTRAINT `model_ibfk_2` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`)
104 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
105 SET character_set_client = @saved_cs_client;
106
107 --
108 -- Dumping data for table `model`
109 --
110
111 LOCK TABLES `model` WRITE;
112 /*!40000 ALTER TABLE `model` DISABLE KEYS */;
113 INSERT INTO `model` VALUES (1,'Rushkoff: Klub extáze',1,1,'9788086096599','23.00','prvni vec s carovym kodem co sem videl'),(3,'Karel Gott - kompletní diskografie',2,2,'4792207502505','666.00','možno použít i k sebeobraně');
114 /*!40000 ALTER TABLE `model` ENABLE KEYS */;
115 UNLOCK TABLES;
116
117 --
118 -- Table structure for table `producer`
119 --
120
121 DROP TABLE IF EXISTS `producer`;
122 SET @saved_cs_client = @@character_set_client;
123 SET character_set_client = utf8;
124 CREATE TABLE `producer` (
125 `producer_id` int(11) NOT NULL auto_increment,
126 `producer_name` varchar(64) collate utf8_czech_ci NOT NULL,
127 `producer_note` varchar(512) collate utf8_czech_ci NOT NULL,
128 PRIMARY KEY (`producer_id`),
129 UNIQUE KEY `producer_name` (`producer_name`)
130 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
131 SET character_set_client = @saved_cs_client;
132
133 --
134 -- Dumping data for table `producer`
135 --
136
137 LOCK TABLES `producer` WRITE;
138 /*!40000 ALTER TABLE `producer` DISABLE KEYS */;
139 INSERT INTO `producer` VALUES (1,'C.C.M.E','Czech Company Making Everything'),(2,'AchAchne Labz','Ach ne');
140 /*!40000 ALTER TABLE `producer` ENABLE KEYS */;
141 UNLOCK TABLES;
142
143 --
144 -- Table structure for table `room`
145 --
146
147 DROP TABLE IF EXISTS `room`;
148 SET @saved_cs_client = @@character_set_client;
149 SET character_set_client = utf8;
150 CREATE TABLE `room` (
151 `room_id` int(11) NOT NULL auto_increment,
152 `room_name` varchar(64) collate utf8_czech_ci NOT NULL,
153 `user_id` int(11) NOT NULL default '0',
154 `room_descript` text collate utf8_czech_ci NOT NULL,
155 PRIMARY KEY (`room_id`),
156 UNIQUE KEY `room_name` (`room_name`),
157 KEY `user_id` (`user_id`)
158 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
159 SET character_set_client = @saved_cs_client;
160
161 --
162 -- Dumping data for table `room`
163 --
164
165 LOCK TABLES `room` WRITE;
166 /*!40000 ALTER TABLE `room` DISABLE KEYS */;
167 INSERT INTO `room` VALUES (1,'BarvyLaky',0,'LakyBarvy');
168 /*!40000 ALTER TABLE `room` ENABLE KEYS */;
169 UNLOCK TABLES;
170
171 --
172 -- Table structure for table `status`
173 --
174
175 DROP TABLE IF EXISTS `status`;
176 SET @saved_cs_client = @@character_set_client;
177 SET character_set_client = utf8;
178 CREATE TABLE `status` (
179 `status_id` int(11) NOT NULL auto_increment,
180 `status_name` varchar(16) collate utf8_czech_ci NOT NULL,
181 PRIMARY KEY (`status_id`),
182 UNIQUE KEY `status_name` (`status_name`)
183 ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
184 SET character_set_client = @saved_cs_client;
185
186 --
187 -- Dumping data for table `status`
188 --
189
190 LOCK TABLES `status` WRITE;
191 /*!40000 ALTER TABLE `status` DISABLE KEYS */;
192 INSERT INTO `status` VALUES (4,'destroyed'),(2,'placed'),(3,'saled'),(1,'stored');
193 /*!40000 ALTER TABLE `status` ENABLE KEYS */;
194 UNLOCK TABLES;
195
196 --
197 -- Table structure for table `transaction`
198 --
199
200 DROP TABLE IF EXISTS `transaction`;
201 SET @saved_cs_client = @@character_set_client;
202 SET character_set_client = utf8;
203 CREATE TABLE `transaction` (
204 `transaction_id` int(11) NOT NULL auto_increment,
205 `item_id` int(11) NOT NULL default '0',
206 `transaction_time` timestamp NOT NULL default CURRENT_TIMESTAMP,
207 `status_id_in` int(11) NOT NULL default '0',
208 `status_id_out` int(11) NOT NULL default '0',
209 `user_id` int(11) NOT NULL default '0',
210 PRIMARY KEY (`transaction_id`)
211 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
212 SET character_set_client = @saved_cs_client;
213
214 --
215 -- Dumping data for table `transaction`
216 --
217
218 LOCK TABLES `transaction` WRITE;
219 /*!40000 ALTER TABLE `transaction` DISABLE KEYS */;
220 /*!40000 ALTER TABLE `transaction` ENABLE KEYS */;
221 UNLOCK TABLES;
222
223 --
224 -- Table structure for table `user`
225 --
226
227 DROP TABLE IF EXISTS `user`;
228 SET @saved_cs_client = @@character_set_client;
229 SET character_set_client = utf8;
230 CREATE TABLE `user` (
231 `user_id` int(11) NOT NULL default '0',
232 `user_permit` enum('user','admin') collate utf8_czech_ci NOT NULL default 'user',
233 UNIQUE KEY `user_id` (`user_id`)
234 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
235 SET character_set_client = @saved_cs_client;
236
237 --
238 -- Dumping data for table `user`
239 --
240
241 LOCK TABLES `user` WRITE;
242 /*!40000 ALTER TABLE `user` DISABLE KEYS */;
243 /*!40000 ALTER TABLE `user` ENABLE KEYS */;
244 UNLOCK TABLES;
245
246 --
247 -- Table structure for table `vendor`
248 --
249
250 DROP TABLE IF EXISTS `vendor`;
251 SET @saved_cs_client = @@character_set_client;
252 SET character_set_client = utf8;
253 CREATE TABLE `vendor` (
254 `vendor_id` int(11) NOT NULL auto_increment,
255 `vendor_name` varchar(64) collate utf8_czech_ci NOT NULL,
256 `vendor_note` varchar(256) collate utf8_czech_ci NOT NULL,
257 PRIMARY KEY (`vendor_id`),
258 UNIQUE KEY `vendor_name` (`vendor_name`)
259 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
260 SET character_set_client = @saved_cs_client;
261
262 --
263 -- Dumping data for table `vendor`
264 --
265
266 LOCK TABLES `vendor` WRITE;
267 /*!40000 ALTER TABLE `vendor` DISABLE KEYS */;
268 INSERT INTO `vendor` VALUES (1,'C.C.S.E','Czech Company Selling Everything'),(2,'Trolo Cybernetix','trololo');
269 /*!40000 ALTER TABLE `vendor` ENABLE KEYS */;
270 UNLOCK TABLES;
271 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
272
273 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
274 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
275 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
276 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
277 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
278 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
279 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
280
281 -- Dump completed on 2011-07-29 3:44:28
This page took 0.386752 seconds and 5 git commands to generate.