]> Shamusworld >> Repos - schematic/blob - schematic-schema.sql
Added a bunch of new functionality
[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   `filename` varchar(256) DEFAULT NULL,
139   `document` longblob,
140   PRIMARY KEY (`did`),
141   KEY `dtid` (`dtid`),
142   KEY `vid` (`vid`),
143   KEY `poid` (`poid`),
144   CONSTRAINT `Documents_ibfk_1` FOREIGN KEY (`dtid`) REFERENCES `DocumentType` (`dtid`)
145 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
146 /*!40101 SET character_set_client = @saved_cs_client */;
147
148 --
149 -- Dumping data for table `Documents`
150 --
151
152 LOCK TABLES `Documents` WRITE;
153 /*!40000 ALTER TABLE `Documents` DISABLE KEYS */;
154 /*!40000 ALTER TABLE `Documents` ENABLE KEYS */;
155 UNLOCK TABLES;
156
157 --
158 -- Table structure for table `History`
159 --
160
161 DROP TABLE IF EXISTS `History`;
162 /*!40101 SET @saved_cs_client     = @@character_set_client */;
163 /*!40101 SET character_set_client = utf8 */;
164 CREATE TABLE `History` (
165   `uid` int(11) DEFAULT NULL,
166   `date` datetime DEFAULT NULL,
167   `note` varchar(100) DEFAULT NULL,
168   KEY `uid` (`uid`),
169   CONSTRAINT `History_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `User` (`uid`)
170 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
171 /*!40101 SET character_set_client = @saved_cs_client */;
172
173 --
174 -- Dumping data for table `History`
175 --
176
177 LOCK TABLES `History` WRITE;
178 /*!40000 ALTER TABLE `History` DISABLE KEYS */;
179 /*!40000 ALTER TABLE `History` ENABLE KEYS */;
180 UNLOCK TABLES;
181
182 --
183 -- Table structure for table `Location`
184 --
185
186 DROP TABLE IF EXISTS `Location`;
187 /*!40101 SET @saved_cs_client     = @@character_set_client */;
188 /*!40101 SET character_set_client = utf8 */;
189 CREATE TABLE `Location` (
190   `lid` int(11) NOT NULL AUTO_INCREMENT,
191   `vid` int(11) DEFAULT NULL,
192   `address` varchar(100) DEFAULT NULL,
193   `city` varchar(64) DEFAULT NULL,
194   `state` varchar(64) DEFAULT NULL,
195   `country` varchar(64) DEFAULT NULL,
196   `code` varchar(32) DEFAULT NULL,
197   PRIMARY KEY (`lid`),
198   KEY `vid` (`vid`),
199   CONSTRAINT `Location_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `Vendor` (`vid`)
200 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
201 /*!40101 SET character_set_client = @saved_cs_client */;
202
203 --
204 -- Dumping data for table `Location`
205 --
206
207 LOCK TABLES `Location` WRITE;
208 /*!40000 ALTER TABLE `Location` DISABLE KEYS */;
209 /*!40000 ALTER TABLE `Location` ENABLE KEYS */;
210 UNLOCK TABLES;
211
212 --
213 -- Table structure for table `Notes`
214 --
215
216 DROP TABLE IF EXISTS `Notes`;
217 /*!40101 SET @saved_cs_client     = @@character_set_client */;
218 /*!40101 SET character_set_client = utf8 */;
219 CREATE TABLE `Notes` (
220   `nid` int(11) NOT NULL AUTO_INCREMENT,
221   `poid` int(11) DEFAULT NULL,
222   `note` varchar(200) DEFAULT NULL,
223   PRIMARY KEY (`nid`)
224 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
225 /*!40101 SET character_set_client = @saved_cs_client */;
226
227 --
228 -- Dumping data for table `Notes`
229 --
230
231 LOCK TABLES `Notes` WRITE;
232 /*!40000 ALTER TABLE `Notes` DISABLE KEYS */;
233 /*!40000 ALTER TABLE `Notes` ENABLE KEYS */;
234 UNLOCK TABLES;
235
236 --
237 -- Table structure for table `PurchaseOrder`
238 --
239
240 DROP TABLE IF EXISTS `PurchaseOrder`;
241 /*!40101 SET @saved_cs_client     = @@character_set_client */;
242 /*!40101 SET character_set_client = utf8 */;
243 CREATE TABLE `PurchaseOrder` (
244   `poid` int(11) NOT NULL AUTO_INCREMENT,
245   `vid` int(11) DEFAULT NULL,
246   `closed` tinyint(1) NOT NULL DEFAULT '0',
247   `poNumber` varchar(100) DEFAULT NULL,
248   `originalDate` date DEFAULT NULL,
249   `adjustedDate` date DEFAULT NULL,
250   `description` varchar(200) DEFAULT NULL,
251   PRIMARY KEY (`poid`),
252   KEY `vid` (`vid`),
253   CONSTRAINT `PurchaseOrder_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `Vendor` (`vid`)
254 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
255 /*!40101 SET character_set_client = @saved_cs_client */;
256
257 --
258 -- Dumping data for table `PurchaseOrder`
259 --
260
261 LOCK TABLES `PurchaseOrder` WRITE;
262 /*!40000 ALTER TABLE `PurchaseOrder` DISABLE KEYS */;
263 /*!40000 ALTER TABLE `PurchaseOrder` ENABLE KEYS */;
264 UNLOCK TABLES;
265
266 --
267 -- Table structure for table `User`
268 --
269
270 DROP TABLE IF EXISTS `User`;
271 /*!40101 SET @saved_cs_client     = @@character_set_client */;
272 /*!40101 SET character_set_client = utf8 */;
273 CREATE TABLE `User` (
274   `uid` int(11) NOT NULL AUTO_INCREMENT,
275   `ucid` int(11) DEFAULT NULL,
276   `name` varchar(64) DEFAULT NULL,
277   `login` varchar(32) DEFAULT NULL,
278   `password` varchar(64) DEFAULT NULL,
279   PRIMARY KEY (`uid`),
280   KEY `ucid` (`ucid`),
281   CONSTRAINT `User_ibfk_1` FOREIGN KEY (`ucid`) REFERENCES `UserClass` (`ucid`)
282 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
283 /*!40101 SET character_set_client = @saved_cs_client */;
284
285 --
286 -- Dumping data for table `User`
287 --
288
289 LOCK TABLES `User` WRITE;
290 /*!40000 ALTER TABLE `User` DISABLE KEYS */;
291 INSERT INTO `User` VALUES (1,1,'Administrator','admin','admin_123');
292 /*!40000 ALTER TABLE `User` ENABLE KEYS */;
293 UNLOCK TABLES;
294
295 --
296 -- Table structure for table `UserClass`
297 --
298
299 DROP TABLE IF EXISTS `UserClass`;
300 /*!40101 SET @saved_cs_client     = @@character_set_client */;
301 /*!40101 SET character_set_client = utf8 */;
302 CREATE TABLE `UserClass` (
303   `ucid` int(11) NOT NULL AUTO_INCREMENT,
304   `privilegeLevel` int(11) NOT NULL DEFAULT '0',
305   `description` varchar(100) DEFAULT NULL,
306   PRIMARY KEY (`ucid`)
307 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
308 /*!40101 SET character_set_client = @saved_cs_client */;
309
310 --
311 -- Dumping data for table `UserClass`
312 --
313
314 LOCK TABLES `UserClass` WRITE;
315 /*!40000 ALTER TABLE `UserClass` DISABLE KEYS */;
316 INSERT INTO `UserClass` VALUES (1,1,'Administrator');
317 /*!40000 ALTER TABLE `UserClass` ENABLE KEYS */;
318 UNLOCK TABLES;
319
320 --
321 -- Table structure for table `Vendor`
322 --
323
324 DROP TABLE IF EXISTS `Vendor`;
325 /*!40101 SET @saved_cs_client     = @@character_set_client */;
326 /*!40101 SET character_set_client = utf8 */;
327 CREATE TABLE `Vendor` (
328   `vid` int(11) NOT NULL AUTO_INCREMENT,
329   `vlid` int(11) DEFAULT NULL,
330   `signedNDA` tinyint(1) NOT NULL DEFAULT '0',
331   `name` varchar(100) DEFAULT NULL,
332   PRIMARY KEY (`vid`),
333   KEY `vlid` (`vlid`),
334   CONSTRAINT `Vendor_ibfk_1` FOREIGN KEY (`vlid`) REFERENCES `VendorLevel` (`vlid`)
335 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
336 /*!40101 SET character_set_client = @saved_cs_client */;
337
338 --
339 -- Dumping data for table `Vendor`
340 --
341
342 LOCK TABLES `Vendor` WRITE;
343 /*!40000 ALTER TABLE `Vendor` DISABLE KEYS */;
344 /*!40000 ALTER TABLE `Vendor` ENABLE KEYS */;
345 UNLOCK TABLES;
346
347 --
348 -- Table structure for table `VendorGroup`
349 --
350
351 DROP TABLE IF EXISTS `VendorGroup`;
352 /*!40101 SET @saved_cs_client     = @@character_set_client */;
353 /*!40101 SET character_set_client = utf8 */;
354 CREATE TABLE `VendorGroup` (
355   `vgid` int(11) NOT NULL AUTO_INCREMENT,
356   `seqNo` int(4) NOT NULL,
357   `description` varchar(100) DEFAULT NULL,
358   PRIMARY KEY (`vgid`)
359 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
360 /*!40101 SET character_set_client = @saved_cs_client */;
361
362 --
363 -- Dumping data for table `VendorGroup`
364 --
365
366 LOCK TABLES `VendorGroup` WRITE;
367 /*!40000 ALTER TABLE `VendorGroup` DISABLE KEYS */;
368 /*!40000 ALTER TABLE `VendorGroup` ENABLE KEYS */;
369 UNLOCK TABLES;
370
371 --
372 -- Table structure for table `VendorLevel`
373 --
374
375 DROP TABLE IF EXISTS `VendorLevel`;
376 /*!40101 SET @saved_cs_client     = @@character_set_client */;
377 /*!40101 SET character_set_client = utf8 */;
378 CREATE TABLE `VendorLevel` (
379   `vlid` int(11) NOT NULL AUTO_INCREMENT,
380   `vendorUsable` tinyint(1) NOT NULL DEFAULT '0',
381   `color` int(4) DEFAULT NULL,
382   `description` varchar(100) DEFAULT NULL,
383   PRIMARY KEY (`vlid`)
384 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
385 /*!40101 SET character_set_client = @saved_cs_client */;
386
387 --
388 -- Dumping data for table `VendorLevel`
389 --
390
391 LOCK TABLES `VendorLevel` WRITE;
392 /*!40000 ALTER TABLE `VendorLevel` DISABLE KEYS */;
393 /*!40000 ALTER TABLE `VendorLevel` ENABLE KEYS */;
394 UNLOCK TABLES;
395
396 --
397 -- Table structure for table `VendorSpecificTypes`
398 --
399
400 DROP TABLE IF EXISTS `VendorSpecificTypes`;
401 /*!40101 SET @saved_cs_client     = @@character_set_client */;
402 /*!40101 SET character_set_client = utf8 */;
403 CREATE TABLE `VendorSpecificTypes` (
404   `vid` int(11) DEFAULT NULL,
405   `vtid` int(11) DEFAULT NULL,
406   KEY `vid` (`vid`),
407   KEY `vtid` (`vtid`),
408   CONSTRAINT `VendorSpecificTypes_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `Vendor` (`vid`),
409   CONSTRAINT `VendorSpecificTypes_ibfk_2` FOREIGN KEY (`vtid`) REFERENCES `VendorType` (`vtid`)
410 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
411 /*!40101 SET character_set_client = @saved_cs_client */;
412
413 --
414 -- Dumping data for table `VendorSpecificTypes`
415 --
416
417 LOCK TABLES `VendorSpecificTypes` WRITE;
418 /*!40000 ALTER TABLE `VendorSpecificTypes` DISABLE KEYS */;
419 /*!40000 ALTER TABLE `VendorSpecificTypes` ENABLE KEYS */;
420 UNLOCK TABLES;
421
422 --
423 -- Table structure for table `VendorType`
424 --
425
426 DROP TABLE IF EXISTS `VendorType`;
427 /*!40101 SET @saved_cs_client     = @@character_set_client */;
428 /*!40101 SET character_set_client = utf8 */;
429 CREATE TABLE `VendorType` (
430   `vtid` int(11) NOT NULL AUTO_INCREMENT,
431   `vgid` int(11) DEFAULT NULL,
432   `seqNo` int(4) NOT NULL,
433   `description` varchar(100) DEFAULT NULL,
434   PRIMARY KEY (`vtid`),
435   KEY `vgid` (`vgid`),
436   CONSTRAINT `VendorType_ibfk_1` FOREIGN KEY (`vgid`) REFERENCES `VendorGroup` (`vgid`)
437 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
438 /*!40101 SET character_set_client = @saved_cs_client */;
439
440 --
441 -- Dumping data for table `VendorType`
442 --
443
444 LOCK TABLES `VendorType` WRITE;
445 /*!40000 ALTER TABLE `VendorType` DISABLE KEYS */;
446 /*!40000 ALTER TABLE `VendorType` ENABLE KEYS */;
447 UNLOCK TABLES;
448 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
449
450 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
451 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
452 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
453 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
454 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
455 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
456 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
457
458 -- Dump completed on 2012-09-19 21:10:12