summaryrefslogtreecommitdiffstats
path: root/modules-available/dnbd3
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-24 12:57:30 +0100
committerSimon Rettberg2017-11-24 12:57:30 +0100
commitb86a3c3c8b6118ef9e2d340330ef4a86539f801e (patch)
treece28a9a682c388ec9aab4efe225af365b39368a9 /modules-available/dnbd3
parentInstaller: Add more helper functions (constraints, response) (diff)
downloadslx-admin-b86a3c3c8b6118ef9e2d340330ef4a86539f801e.tar.gz
slx-admin-b86a3c3c8b6118ef9e2d340330ef4a86539f801e.tar.xz
slx-admin-b86a3c3c8b6118ef9e2d340330ef4a86539f801e.zip
[dnbd3] Add installer script
Diffstat (limited to 'modules-available/dnbd3')
-rw-r--r--modules-available/dnbd3/install.inc.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules-available/dnbd3/install.inc.php b/modules-available/dnbd3/install.inc.php
new file mode 100644
index 00000000..c5096cfe
--- /dev/null
+++ b/modules-available/dnbd3/install.inc.php
@@ -0,0 +1,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);