summaryrefslogtreecommitdiffstats
path: root/setup
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-22 12:31:48 +0200
committerBjörn Geiger2011-08-22 12:31:48 +0200
commitbdbf7625d172fa64e7694f3bf37eed642517bbe1 (patch)
tree9e7b2593693dde4d0c224169b6c189bafc7feb72 /setup
parentminor (diff)
downloadpoolctrl-bdbf7625d172fa64e7694f3bf37eed642517bbe1.tar.gz
poolctrl-bdbf7625d172fa64e7694f3bf37eed642517bbe1.tar.xz
poolctrl-bdbf7625d172fa64e7694f3bf37eed642517bbe1.zip
Datenbankänderung
Diffstat (limited to 'setup')
-rw-r--r--setup/poolctrl.sql21
-rw-r--r--setup/poolctrl_data.sql17
2 files changed, 14 insertions, 24 deletions
diff --git a/setup/poolctrl.sql b/setup/poolctrl.sql
index 470716e..3580485 100644
--- a/setup/poolctrl.sql
+++ b/setup/poolctrl.sql
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `poolctrl_event` (
`repeat` bool NOT NULL DEFAULT false,
`immediate` bool NOT NULL DEFAULT false,
`running` bool NOT NULL DEFAULT false,
- `runningtype` int(11) NOT NULL DEFAULT '0',
+ `runningtype` int(11) DEFAULT NULL,
PRIMARY KEY (`eventID`),
KEY `pbs_poolID` (`pbs_poolID`),
KEY `pbs_membershipID` (`pbs_membershipID`),
@@ -31,10 +31,10 @@ CREATE TABLE IF NOT EXISTS `poolctrl_event` (
KEY `runningtype` (`runningtype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-CREATE TABLE IF NOT EXISTS `poolctrl_runningtype` (
- `runningtypeID` int(11) NOT NULL AUTO_INCREMENT,
+CREATE TABLE IF NOT EXISTS `poolctrl_eventtype` (
+ `eventtypeID` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
- PRIMARY KEY (`runningTypID`)
+ PRIMARY KEY (`eventtypeID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS `poolctrl_eventcategory` (
@@ -45,7 +45,8 @@ CREATE TABLE IF NOT EXISTS `poolctrl_eventcategory` (
CREATE TABLE IF NOT EXISTS `poolctrl_eventreport` (
`reportID` int(11) NOT NULL AUTO_INCREMENT,
- `report` varchar(140) COLLATE utf8_unicode_ci DEFAULT 'success',
+ `result` varchar(140) COLLATE utf8_unicode_ci DEFAULT 'success',
+ `errors` varchar(140) COLLATE utf8_unicode_ci,
`type` int(11) NOT NULL,
`eventID` int(11) NOT NULL,
`timestamp` timestamp COLLATE utf8_unicode_ci NOT NULL DEFAULT CURRENT_TIMESTAMP(),
@@ -54,12 +55,6 @@ CREATE TABLE IF NOT EXISTS `poolctrl_eventreport` (
KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-CREATE TABLE IF NOT EXISTS `poolctrl_reporttype` (
- `reporttypeID` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
- PRIMARY KEY (`reporttypeID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-
-- PBS2 Tabellen
-- TO DO: Tabellen an dieser Stelle nicht per Hand erzeugen sondern von der PBS2-Datenbank kopieren, sodass diese auf dem neusten Stand sind
CREATE TABLE IF NOT EXISTS `pbs_bootos` (
@@ -194,13 +189,13 @@ ALTER TABLE `pbs_membership`
ALTER TABLE `poolctrl_eventreport`
ADD CONSTRAINT `pbs_eventreport_eventidC` FOREIGN KEY (`eventID`) REFERENCES `poolctrl_event` (`eventID`) ON DELETE CASCADE,
- ADD CONSTRAINT `pbs_eventreport_typeidC` FOREIGN KEY (`type`) REFERENCES `poolctrl_reporttype` (`reporttypeID`) ON DELETE CASCADE;
+ ADD CONSTRAINT `pbs_eventreport_typeidC` FOREIGN KEY (`type`) REFERENCES `poolctrl_eventtype` (`eventtypeID`) ON DELETE CASCADE;
ALTER TABLE `poolctrl_event`
ADD CONSTRAINT `poolctrl_event_poolidC` FOREIGN KEY (`pbs_poolID`) REFERENCES `pbs_pool` (`poolID`) ON DELETE CASCADE,
ADD CONSTRAINT `poolctrl_event_bootosidC` FOREIGN KEY (`pbs_bootosID`) REFERENCES `pbs_bootos` (`bootosID`) ON DELETE CASCADE,
ADD CONSTRAINT `poolctrl_event_membershipidC` FOREIGN KEY (`pbs_membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE,
ADD CONSTRAINT `poolctrl_event_categoryC` FOREIGN KEY (`category`) REFERENCES `poolctrl_eventcategory` (`eventcategoryID`) ON DELETE CASCADE,
- ADD CONSTRAINT `poolctrl_event_runningtypeC` FOREIGN KEY (`runningtype`) REFERENCES `poolctrl_runningtype` (`runningtype`) ON DELETE SET NULl,
+ ADD CONSTRAINT `poolctrl_event_runningtypeC` FOREIGN KEY (`runningtype`) REFERENCES `poolctrl_eventtype` (`eventtypeID`) ON DELETE SET NULL,
ADD CONSTRAINT `poolctrl_event_startC` CHECK (start > CURRENT_TIMESTAMP()),
ADD CONSTRAINT `poolctrl_event_endC` CHECK (end > start);
diff --git a/setup/poolctrl_data.sql b/setup/poolctrl_data.sql
index f22da32..57df655 100644
--- a/setup/poolctrl_data.sql
+++ b/setup/poolctrl_data.sql
@@ -90,8 +90,8 @@ INSERT INTO `poolctrl_eventcategory` (`eventcategoryID`, `title`) VALUES
(3, 'Boot'),
(4, 'Shutdown');
--- Adding runningtypes
-INSERT INTO `poolctrl_runningtype` (`runningtypeID`, `title`) VALUES
+-- Adding eventtypes
+INSERT INTO `poolctrl_eventtype` (`eventtypeID`, `title`) VALUES
(1, 'Boot'),
(2, 'Shutdown');
@@ -101,13 +101,8 @@ INSERT INTO `poolctrl_event` (`eventID`, `title`, `start`, `end`, `category`, `p
(2, 'Systeme II', '2011-06-24 14:10:00', '2011-06-24 16:00:00', '1', 1, 1, 1, 'Systeme II Vorlesung', 1, 1),
(3, 'Systeme III', '2011-06-24 16:10:00', '2011-06-24 18:00:00', '1', 1, 1, 1, 'Systeme III Vorlesung', 1, 1);
--- Adding reporttypes
-INSERT INTO `poolctrl_reporttype` (`reporttypeID`, `title`) VALUES
-(1, 'Boot'),
-(2, 'Shutdown');
-
-- Adding eventreports
-INSERT INTO `poolctrl_eventreport` (`reportID`, `report`, `type`, `eventID`) VALUES
-(1, DEFAULT, 1, 1),
-(2, DEFAULT, 1, 2),
-(3, 'wake-on-lan failed', 1, 3);
+INSERT INTO `poolctrl_eventreport` (`reportID`, `result`, `errors`, `type`, `eventID`) VALUES
+(1, DEFAULT, null, 1, 1),
+(2, DEFAULT, null, 1, 2),
+(3, 'failed', 'wake-on-lan failed', 1, 3);