]> Shamusworld >> Repos - schematic/blob - schematic-schema.sql
Initial commit.
[schematic] / schematic-schema.sql
1 -- MySQL dump 10.13  Distrib 5.1.62, for pc-linux-gnu (x86_64)
2 --
3 -- Host: localhost    Database: schematic
4 -- ------------------------------------------------------
5 -- Server version       5.1.62-log
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 `Alerts`
20 --
21
22 DROP TABLE IF EXISTS `Alerts`;
23 /*!40101 SET @saved_cs_client     = @@character_set_client */;
24 /*!40101 SET character_set_client = utf8 */;
25 CREATE TABLE `Alerts` (
26   `aid` int(11) NOT NULL AUTO_INCREMENT,
27   `uid` int(11) DEFAULT NULL,
28   `nid` int(11) DEFAULT NULL,
29   `date` date DEFAULT NULL,
30   `description` varchar(200) DEFAULT NULL,
31   PRIMARY KEY (`aid`),
32   KEY `uid` (`uid`),
33   CONSTRAINT `Alerts_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `User` (`uid`)
34 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
35 /*!40101 SET character_set_client = @saved_cs_client */;
36
37 --
38 -- Dumping data for table `Alerts`
39 --
40
41 LOCK TABLES `Alerts` WRITE;
42 /*!40000 ALTER TABLE `Alerts` DISABLE KEYS */;
43 /*!40000 ALTER TABLE `Alerts` ENABLE KEYS */;
44 UNLOCK TABLES;
45
46 --
47 -- Table structure for table `Contact`
48 --
49
50 DROP TABLE IF EXISTS `Contact`;
51 /*!40101 SET @saved_cs_client     = @@character_set_client */;
52 /*!40101 SET character_set_client = utf8 */;
53 CREATE TABLE `Contact` (
54   `cid` int(11) NOT NULL AUTO_INCREMENT,
55   `vid` int(11) DEFAULT NULL,
56   `CTID` int(11) DEFAULT NULL,
57   `name` varchar(64) DEFAULT NULL,
58   `email` varchar(64) DEFAULT NULL,
59   `address` varchar(200) DEFAULT NULL,
60   `phone1` varchar(32) DEFAULT NULL,
61   `phone2` varchar(32) DEFAULT NULL,
62   `fax` varchar(32) DEFAULT NULL,
63   PRIMARY KEY (`cid`),
64   KEY `vid` (`vid`),
65   KEY `CTID` (`CTID`),
66   CONSTRAINT `Contact_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `Vendor` (`vid`),
67   CONSTRAINT `Contact_ibfk_2` FOREIGN KEY (`CTID`) REFERENCES `ContactType` (`ctid`)
68 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
69 /*!40101 SET character_set_client = @saved_cs_client */;
70
71 --
72 -- Dumping data for table `Contact`
73 --
74
75 LOCK TABLES `Contact` WRITE;
76 /*!40000 ALTER TABLE `Contact` DISABLE KEYS */;
77 /*!40000 ALTER TABLE `Contact` ENABLE KEYS */;
78 UNLOCK TABLES;
79
80 --
81 -- Table structure for table `ContactType`
82 --
83
84 DROP TABLE IF EXISTS `ContactType`;
85 /*!40101 SET @saved_cs_client     = @@character_set_client */;
86 /*!40101 SET character_set_client = utf8 */;
87 CREATE TABLE `ContactType` (
88   `ctid` int(11) NOT NULL AUTO_INCREMENT,
89   `description` varchar(100) DEFAULT NULL,
90   PRIMARY KEY (`ctid`)
91 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
92 /*!40101 SET character_set_client = @saved_cs_client */;
93
94 --
95 -- Dumping data for table `ContactType`
96 --
97
98 LOCK TABLES `ContactType` WRITE;
99 /*!40000 ALTER TABLE `ContactType` DISABLE KEYS */;
100 /*!40000 ALTER TABLE `ContactType` ENABLE KEYS */;
101 UNLOCK TABLES;
102
103 --
104 -- Table structure for table `DocumentType`
105 --
106
107 DROP TABLE IF EXISTS `DocumentType`;
108 /*!40101 SET @saved_cs_client     = @@character_set_client */;
109 /*!40101 SET character_set_client = utf8 */;
110 CREATE TABLE `DocumentType` (
111   `dtid` int(11) NOT NULL AUTO_INCREMENT,
112   `description` varchar(100) DEFAULT NULL,
113   PRIMARY KEY (`dtid`)
114 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
115 /*!40101 SET character_set_client = @saved_cs_client */;
116
117 --
118 -- Dumping data for table `DocumentType`
119 --
120
121 LOCK TABLES `DocumentType` WRITE;
122 /*!40000 ALTER TABLE `DocumentType` DISABLE KEYS */;
123 /*!40000 ALTER TABLE `DocumentType` ENABLE KEYS */;
124 UNLOCK TABLES;
125
126 --
127 -- Table structure for table `Documents`
128 --
129
130 DROP TABLE IF EXISTS `Documents`;
131 /*!40101 SET @saved_cs_client     = @@character_set_client */;
132 /*!40101 SET character_set_client = utf8 */;
133 CREATE TABLE `Documents` (
134   `did` int(11) NOT NULL AUTO_INCREMENT,
135   `dtid` int(11) DEFAULT NULL,
136   `vid` int(11) DEFAULT NULL,
137   `poid` int(11) DEFAULT NULL,
138   `document` longblob,
139   PRIMARY KEY (`did`),
140   KEY `dtid` (`dtid`),
141   KEY `vid` (`vid`),
142   KEY `poid` (`poid`),
143   CONSTRAINT `Documents_ibfk_1` FOREIGN KEY (`dtid`) REFERENCES `DocumentType` (`dtid`)
144 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
145 /*!40101 SET character_set_client = @saved_cs_client */;
146
147 --
148 -- Dumping data for table `Documents`
149 --
150
151 LOCK TABLES `Documents` WRITE;
152 /*!40000 ALTER TABLE `Documents` DISABLE KEYS */;
153 /*!40000 ALTER TABLE `Documents` ENABLE KEYS */;
154 UNLOCK TABLES;
155
156 --
157 -- Table structure for table `History`
158 --
159
160 DROP TABLE IF EXISTS `History`;
161 /*!40101 SET @saved_cs_client     = @@character_set_client */;
162 /*!40101 SET character_set_client = utf8 */;
163 CREATE TABLE `History` (
164   `uid` int(11) DEFAULT NULL,
165   `date` datetime DEFAULT NULL,
166   `note` varchar(100) DEFAULT NULL,
167   KEY `uid` (`uid`),
168   CONSTRAINT `History_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `User` (`uid`)
169 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
170 /*!40101 SET character_set_client = @saved_cs_client */;
171
172 --
173 -- Dumping data for table `History`
174 --
175
176 LOCK TABLES `History` WRITE;
177 /*!40000 ALTER TABLE `History` DISABLE KEYS */;
178 /*!40000 ALTER TABLE `History` ENABLE KEYS */;
179 UNLOCK TABLES;
180
181 --
182 -- Table structure for table `Notes`
183 --
184
185 DROP TABLE IF EXISTS `Notes`;
186 /*!40101 SET @saved_cs_client     = @@character_set_client */;
187 /*!40101 SET character_set_client = utf8 */;
188 CREATE TABLE `Notes` (
189   `nid` int(11) NOT NULL AUTO_INCREMENT,
190   `poid` int(11) DEFAULT NULL,
191   `note` varchar(200) DEFAULT NULL,
192   PRIMARY KEY (`nid`)
193 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
194 /*!40101 SET character_set_client = @saved_cs_client */;
195
196 --
197 -- Dumping data for table `Notes`
198 --
199
200 LOCK TABLES `Notes` WRITE;
201 /*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
202 /*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
203 UNLOCK TABLES;
204
205 --
206 -- Table structure for table `PurchaseOrder`
207 --
208
209 DROP TABLE IF EXISTS `PurchaseOrder`;
210 /*!40101 SET @saved_cs_client     = @@character_set_client */;
211 /*!40101 SET character_set_client = utf8 */;
212 CREATE TABLE `PurchaseOrder` (
213   `poid` int(11) NOT NULL AUTO_INCREMENT,
214   `vid` int(11) DEFAULT NULL,
215   `closed` tinyint(1) NOT NULL DEFAULT '0',
216   `description` varchar(200) DEFAULT NULL,
217   PRIMARY KEY (`poid`),
218   KEY `vid` (`vid`),
219   CONSTRAINT `PurchaseOrder_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `Vendor` (`vid`)
220 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
221 /*!40101 SET character_set_client = @saved_cs_client */;
222
223 --
224 -- Dumping data for table `PurchaseOrder`
225 --
226
227 LOCK TABLES `PurchaseOrder` WRITE;
228 /*!40000 ALTER TABLE `PurchaseOrder` DISABLE KEYS */;
229 /*!40000 ALTER TABLE `PurchaseOrder` ENABLE KEYS */;
230 UNLOCK TABLES;
231
232 --
233 -- Table structure for table `User`
234 --
235
236 DROP TABLE IF EXISTS `User`;
237 /*!40101 SET @saved_cs_client     = @@character_set_client */;
238 /*!40101 SET character_set_client = utf8 */;
239 CREATE TABLE `User` (
240   `uid` int(11) NOT NULL AUTO_INCREMENT,
241   `ucid` int(11) DEFAULT NULL,
242   `name` varchar(64) DEFAULT NULL,
243   `login` varchar(32) DEFAULT NULL,
244   `password` varchar(64) DEFAULT NULL,
245   PRIMARY KEY (`uid`),
246   KEY `ucid` (`ucid`),
247   CONSTRAINT `User_ibfk_1` FOREIGN KEY (`ucid`) REFERENCES `UserClass` (`ucid`)
248 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
249 /*!40101 SET character_set_client = @saved_cs_client */;
250
251 --
252 -- Dumping data for table `User`
253 --
254
255 LOCK TABLES `User` WRITE;
256 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
257 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
258 UNLOCK TABLES;
259
260 --
261 -- Table structure for table `UserClass`
262 --
263
264 DROP TABLE IF EXISTS `UserClass`;
265 /*!40101 SET @saved_cs_client     = @@character_set_client */;
266 /*!40101 SET character_set_client = utf8 */;
267 CREATE TABLE `UserClass` (
268   `ucid` int(11) NOT NULL AUTO_INCREMENT,
269   `privilegeLevel` int(11) NOT NULL DEFAULT '0',
270   `description` varchar(100) DEFAULT NULL,
271   PRIMARY KEY (`ucid`)
272 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
273 /*!40101 SET character_set_client = @saved_cs_client */;
274
275 --
276 -- Dumping data for table `UserClass`
277 --
278
279 LOCK TABLES `UserClass` WRITE;
280 /*!40000 ALTER TABLE `UserClass` DISABLE KEYS */;
281 /*!40000 ALTER TABLE `UserClass` ENABLE KEYS */;
282 UNLOCK TABLES;
283
284 --
285 -- Table structure for table `Vendor`
286 --
287
288 DROP TABLE IF EXISTS `Vendor`;
289 /*!40101 SET @saved_cs_client     = @@character_set_client */;
290 /*!40101 SET character_set_client = utf8 */;
291 CREATE TABLE `Vendor` (
292   `vid` int(11) NOT NULL AUTO_INCREMENT,
293   `vlid` int(11) DEFAULT NULL,
294   `name` varchar(100) DEFAULT NULL,
295   PRIMARY KEY (`vid`),
296   KEY `vlid` (`vlid`),
297   CONSTRAINT `Vendor_ibfk_1` FOREIGN KEY (`vlid`) REFERENCES `VendorLevel` (`vlid`)
298 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
299 /*!40101 SET character_set_client = @saved_cs_client */;
300
301 --
302 -- Dumping data for table `Vendor`
303 --
304
305 LOCK TABLES `Vendor` WRITE;
306 /*!40000 ALTER TABLE `Vendor` DISABLE KEYS */;
307 /*!40000 ALTER TABLE `Vendor` ENABLE KEYS */;
308 UNLOCK TABLES;
309
310 --
311 -- Table structure for table `VendorGroup`
312 --
313
314 DROP TABLE IF EXISTS `VendorGroup`;
315 /*!40101 SET @saved_cs_client     = @@character_set_client */;
316 /*!40101 SET character_set_client = utf8 */;
317 CREATE TABLE `VendorGroup` (
318   `vgid` int(11) NOT NULL AUTO_INCREMENT,
319   `description` varchar(100) DEFAULT NULL,
320   PRIMARY KEY (`vgid`)
321 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
322 /*!40101 SET character_set_client = @saved_cs_client */;
323
324 --
325 -- Dumping data for table `VendorGroup`
326 --
327
328 LOCK TABLES `VendorGroup` WRITE;
329 /*!40000 ALTER TABLE `VendorGroup` DISABLE KEYS */;
330 /*!40000 ALTER TABLE `VendorGroup` ENABLE KEYS */;
331 UNLOCK TABLES;
332
333 --
334 -- Table structure for table `VendorLevel`
335 --
336
337 DROP TABLE IF EXISTS `VendorLevel`;
338 /*!40101 SET @saved_cs_client     = @@character_set_client */;
339 /*!40101 SET character_set_client = utf8 */;
340 CREATE TABLE `VendorLevel` (
341   `vlid` int(11) NOT NULL AUTO_INCREMENT,
342   `vendorUsable` tinyint(1) NOT NULL DEFAULT '0',
343   `color` int(4) DEFAULT NULL,
344   `description` varchar(100) DEFAULT NULL,
345   PRIMARY KEY (`vlid`)
346 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
347 /*!40101 SET character_set_client = @saved_cs_client */;
348
349 --
350 -- Dumping data for table `VendorLevel`
351 --
352
353 LOCK TABLES `VendorLevel` WRITE;
354 /*!40000 ALTER TABLE `VendorLevel` DISABLE KEYS */;
355 /*!40000 ALTER TABLE `VendorLevel` ENABLE KEYS */;
356 UNLOCK TABLES;
357
358 --
359 -- Table structure for table `VendorSpecificTypes`
360 --
361
362 DROP TABLE IF EXISTS `VendorSpecificTypes`;
363 /*!40101 SET @saved_cs_client     = @@character_set_client */;
364 /*!40101 SET character_set_client = utf8 */;
365 CREATE TABLE `VendorSpecificTypes` (
366   `vid` int(11) DEFAULT NULL,
367   `vtid` int(11) DEFAULT NULL,
368   KEY `vid` (`vid`),
369   KEY `vtid` (`vtid`),
370   CONSTRAINT `VendorSpecificTypes_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `Vendor` (`vid`),
371   CONSTRAINT `VendorSpecificTypes_ibfk_2` FOREIGN KEY (`vtid`) REFERENCES `VendorType` (`vtid`)
372 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
373 /*!40101 SET character_set_client = @saved_cs_client */;
374
375 --
376 -- Dumping data for table `VendorSpecificTypes`
377 --
378
379 LOCK TABLES `VendorSpecificTypes` WRITE;
380 /*!40000 ALTER TABLE `VendorSpecificTypes` DISABLE KEYS */;
381 /*!40000 ALTER TABLE `VendorSpecificTypes` ENABLE KEYS */;
382 UNLOCK TABLES;
383
384 --
385 -- Table structure for table `VendorType`
386 --
387
388 DROP TABLE IF EXISTS `VendorType`;
389 /*!40101 SET @saved_cs_client     = @@character_set_client */;
390 /*!40101 SET character_set_client = utf8 */;
391 CREATE TABLE `VendorType` (
392   `vtid` int(11) NOT NULL AUTO_INCREMENT,
393   `vgid` int(11) DEFAULT NULL,
394   `description` varchar(100) DEFAULT NULL,
395   PRIMARY KEY (`vtid`),
396   KEY `vgid` (`vgid`),
397   CONSTRAINT `VendorType_ibfk_1` FOREIGN KEY (`vgid`) REFERENCES `VendorGroup` (`vgid`)
398 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
399 /*!40101 SET character_set_client = @saved_cs_client */;
400
401 --
402 -- Dumping data for table `VendorType`
403 --
404
405 LOCK TABLES `VendorType` WRITE;
406 /*!40000 ALTER TABLE `VendorType` DISABLE KEYS */;
407 /*!40000 ALTER TABLE `VendorType` ENABLE KEYS */;
408 UNLOCK TABLES;
409 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
410
411 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
412 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
413 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
414 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
415 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
416 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
417 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
418
419 -- Dump completed on 2012-09-18 19:39:04