-
Notifications
You must be signed in to change notification settings - Fork 1
/
tables.sql2
65 lines (62 loc) · 2.29 KB
/
tables.sql2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CREATE TABLE `visitor` (
`vid` int(11) NOT NULL AUTO_INCREMENT,
`vname` varchar(32) NOT NULL,
`vphone` varchar(12) NOT NULL,
`vgender` varchar(12) DEFAULT NULL,
`vage` int(11) NOT NULL,
`vaddress` varchar(256) NOT NULL,
`vcomments` varchar(512) DEFAULT NULL,
`vctime` datetime NOT NULL,
`vmtime` datetime NOT NULL,
`vatime` datetime NOT NULL,
`vphoto` mediumblob,
PRIMARY KEY (`vid`),
UNIQUE KEY `vphone` (`vphone`)
) ENGINE=InnoDB AUTO_INCREMENT=2091 DEFAULT CHARSET=latin1
CREATE TABLE `vrecord` (
`vid` int(11) NOT NULL,
`vrecordid` int(11) NOT NULL AUTO_INCREMENT,
`vvehicle_reg_num` varchar(32) DEFAULT NULL,
`vvehicle_type` varchar(16) DEFAULT NULL,
`vvehicle_details` varchar(128) DEFAULT NULL,
`vitime` datetime NOT NULL,
`votime` datetime DEFAULT NULL,
`vflatnum` varchar(24) NOT NULL,
`vblock` varchar(32) NOT NULL,
`vpurpose` varchar(128) DEFAULT NULL,
`vtomeet` varchar(32) NOT NULL,
`vnum_visitors` int(11) DEFAULT NULL,
`vrcomments` varchar(256) DEFAULT NULL,
`vduration_fillup` int(11) DEFAULT NULL,
`vgate` int(3) DEFAULT '0',
`vogate` int(3) DEFAULT NULL,
PRIMARY KEY (`vrecordid`),
KEY `vid` (`vid`),
CONSTRAINT `vrecord_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `visitor` (`vid`)
) ENGINE=InnoDB AUTO_INCREMENT=11151 DEFAULT CHARSET=latin1
CREATE TABLE `vpic` (
`vpicid` int(11) NOT NULL AUTO_INCREMENT,
`vid` int(11) NOT NULL,
`vphoto` mediumblob,
PRIMARY KEY (`vpicid`),
KEY `vid` (`vid`),
CONSTRAINT `vpic_ibfk_1` FOREIGN KEY (`vid`) REFERENCES `visitor` (`vid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
CREATE TABLE `vunit` (
`vunitid` int(11) NOT NULL AUTO_INCREMENT,
`vblock` varchar(32) NOT NULL,
`vflatnum` varchar(24) NOT NULL,
`vintercom` varchar(12) DEFAULT NULL,
`vointercom` varchar(12) DEFAULT NULL,
-- to record flats that have never been visited
`lvrecordid` int(11) DEFAULT NULL,
-- to record flats that have not been visited for a specific period
`lvitime` datetime DEFAULT NULL,
PRIMARY KEY (`vunitid`),
UNIQUE KEY `unique_index` (`vblock`,`vflatnum`)
) ENGINE=InnoDB AUTO_INCREMENT=6573 DEFAULT CHARSET=latin1
CREATE TABLE `vconfig`(
`cfield` varchar(32) NOT NULL,
`cname` varchar(32) NOT NULL,
UNIQUE KEY `unique_index` (`cfield`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;