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
|
<?php
$res = array();
$res[] = tableCreate('dnbd3_server', "
`serverid` int(11) NOT NULL AUTO_INCREMENT,
`machineuuid` char(36) CHARACTER SET ascii DEFAULT NULL,
`fixedip` varchar(45) CHARACTER SET ascii DEFAULT NULL,
`runid` bigint(20) NOT NULL DEFAULT '0',
`lastseen` bigint(20) NOT NULL DEFAULT '0',
`uptime` bigint(20) NOT NULL DEFAULT '0',
`totalup` bigint(20) NOT NULL DEFAULT '0',
`totaldown` bigint(20) NOT NULL DEFAULT '0',
`lastup` bigint(20) NOT NULL DEFAULT '0',
`lastdown` bigint(20) NOT NULL DEFAULT '0',
`clientcount` int(11) NOT NULL DEFAULT '0',
`disktotal` bigint(20) NOT NULL DEFAULT '0',
`diskfree` bigint(20) NOT NULL DEFAULT '0',
`errormsg` varchar(200) DEFAULT NULL,
PRIMARY KEY (`serverid`),
UNIQUE KEY `machineuuid` (`machineuuid`),
UNIQUE KEY `fixedip` (`fixedip`)
");
$res[] = tableCreate('dnbd3_server_x_location', '
`serverid` int(11) NOT NULL,
`locationid` int(11) NOT NULL,
PRIMARY KEY (`serverid`,`locationid`),
KEY `locationid` (`locationid`)
');
$res[] = tableAddConstraint('dnbd3_server', 'machineuuid', 'machine', 'machineuuid',
'ON UPDATE CASCADE ON DELETE CASCADE');
$res[] = tableAddConstraint('dnbd3_server_x_location', 'locationid', 'location', 'locationid',
'ON UPDATE CASCADE ON DELETE CASCADE');
$res[] = tableAddConstraint('dnbd3_server_x_location', 'serverid', 'dnbd3_server', 'serverid',
'ON UPDATE CASCADE ON DELETE CASCADE');
responseFromArray($res);
|