From 3c8f2a7c26ca065ef33e85661d3e9e299b9aeb3f Mon Sep 17 00:00:00 2001
From: Björn Geiger
Date: Wed, 29 Jun 2011 17:04:33 +0200
Subject: Eventcategory nun in eigener Tabelle

---
 setup/poolctrl.sql | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'setup/poolctrl.sql')

diff --git a/setup/poolctrl.sql b/setup/poolctrl.sql
index c861bdf..9be8e3e 100644
--- a/setup/poolctrl.sql
+++ b/setup/poolctrl.sql
@@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `poolctrl_event` (
   `start` timestamp COLLATE utf8_unicode_ci NOT NULL DEFAULT CURRENT_TIMESTAMP(),
   `end` timestamp COLLATE utf8_unicode_ci NOT NULL,
   `participants` int(4) NOT NULL DEFAULT 50 CHECK (participants > 0),
-  `category` varchar(30) COLLATE utf8_unicode_ci,
+  `category` int(11) NOT NULL,
   `pbs_poolID` int(11) NOT NULL,
   `pbs_membershipID` int(11) NOT NULL,
   `pbs_bootosID` int(11) NOT NULL,
@@ -25,9 +25,14 @@ CREATE TABLE IF NOT EXISTS `poolctrl_eventreport` (
   `report` varchar(140) COLLATE utf8_unicode_ci DEFAULT 'success',
   `eventID` int(11) NOT NULL,
   `timestamp` timestamp COLLATE utf8_unicode_ci NOT NULL DEFAULT CURRENT_TIMESTAMP(),
-  PRIMARY KEY (`reportID`),
-  FOREIGN KEY (`eventID`) references poolctrl_event(eventID)
-) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5;
+  PRIMARY KEY (`reportID`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS `poolctrl_eventcategory` (
+  `eventcategoryID` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
+  PRIMARY KEY (`eventcategoryID`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
 
 
 -- PBS2 Tabellen
@@ -174,5 +179,6 @@ ALTER TABLE `poolctrl_event`
   ADD CONSTRAINT `poolctrl_event_poolidC` FOREIGN KEY (`pbs_poolID`) REFERENCES `pbs_pool` (`poolID`) ON DELETE CASCADE,
   ADD CONSTRAINT `poolctrl_event_membershipC` FOREIGN KEY (`pbs_membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE,
   ADD CONSTRAINT `poolctrl_event_boolisoidC` FOREIGN KEY (`pbs_bootosID`) REFERENCES `pbs_bootos` (`bootosID`) ON DELETE CASCADE,
+  ADD CONSTRAINT `poolctrl_event_categoryC` FOREIGN KEY (`category`) REFERENCES `poolctrl_eventcategory` (`eventcategoryID`) ON DELETE CASCADE,
   ADD CONSTRAINT `poolctrl_event_startC` CHECK (start > CURRENT_TIMESTAMP()),
   ADD CONSTRAINT `poolctrl_event_endC` CHECK (end > start);
-- 
cgit v1.2.3-55-g7522

