From 3869fa5e1a518375497b7f6a59b620bc22aef8c3 Mon Sep 17 00:00:00 2001
From: Björn Geiger
Date: Thu, 10 Mar 2011 14:22:41 +0100
Subject: bei Verknüpfungstabellen zusammengesetzter primary key erzeugt, Zend
 braucht primary key

---
 pbs.sql | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'pbs.sql')

diff --git a/pbs.sql b/pbs.sql
index a4149c2..5cf0c5a 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -33,6 +33,7 @@ ALTER TABLE `pbs_role`
 CREATE TABLE IF NOT EXISTS `pbs_rightroles` (
   `roleID` int(11) NOT NULL,
   `rightID` int(11) NOT NULL,
+  PRIMARY KEY (`roleID`,`rightID`),
   KEY `roleID` (`roleID`),
   KEY `rightID` (`rightID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -45,6 +46,7 @@ ALTER TABLE `pbs_rightroles`
 CREATE TABLE IF NOT EXISTS `pbs_groupgroups` (
   `parentID` int(11) NOT NULL,
   `groupID` int(11) NOT NULL,
+  PRIMARY KEY (`parentID`,`groupID`),
   KEY `parentID` (`parentID`),
   KEY `groupID` (`groupID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -140,7 +142,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootos` (
 ALTER TABLE `pbs_bootos`
   ADD CONSTRAINT `pbs_bootos_ibfk_1` FOREIGN KEY (`configID`) REFERENCES `pbs_config` (`configID`),
   ADD CONSTRAINT `pbs_bootos_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE,
-  ADD CONSTRAINT `pbs_bootos_ibfk_3` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`);
+  ADD CONSTRAINT `pbs_bootos_ibfk_3` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE SET NULL;
 
 CREATE TABLE IF NOT EXISTS `pbs_bootmenu` (
   `bootmenuID` int(11) NOT NULL AUTO_INCREMENT,
@@ -192,7 +194,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootiso` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
 ALTER TABLE `pbs_bootiso`
-  ADD CONSTRAINT `pbs_bootiso_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`),
+  ADD CONSTRAINT `pbs_bootiso_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE SET NULL,
   ADD CONSTRAINT `pbs_bootiso_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE;
 
 CREATE TABLE IF NOT EXISTS `pbs_client` (
@@ -231,6 +233,7 @@ CREATE TABLE IF NOT EXISTS `pbs_pool` (
 CREATE TABLE IF NOT EXISTS `pbs_poolentries` (
   `poolID` int(11) NOT NULL,
   `clientID` int(11) NOT NULL,
+  PRIMARY KEY (`poolID`,`clientID`),
   KEY `poolID` (`poolID`),
   KEY `clientID` (`clientID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -263,6 +266,7 @@ ALTER TABLE `pbs_filter`
 CREATE TABLE IF NOT EXISTS `pbs_membershipfilters` (
   `membershipID` int(11) NOT NULL,
   `filterID` int(11) NOT NULL,
+  PRIMARY KEY (`membershipID`,`filterID`),
   KEY `membershipID` (`membershipID`),
   KEY `filterID` (`filterID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -274,6 +278,7 @@ ALTER TABLE `pbs_membershipfilters`
 CREATE TABLE IF NOT EXISTS `pbs_poolfilters` (
   `poolID` int(11) NOT NULL,
   `filterID` int(11) NOT NULL,
+  PRIMARY KEY (`poolID`,`filterID`),
   KEY `poolID` (`poolID`),
   KEY `filterID` (`filterID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -293,6 +298,7 @@ CREATE TABLE IF NOT EXISTS `pbs_filterentries` (
   `filtertypeID` int(11) NOT NULL,
   `filtervalue` varchar(140) NOT NULL,
   `filtervalue2` varchar(140) NOT NULL,
+  PRIMARY KEY (`filterID`,`filtertypeID`),
   KEY `filterID` (`filterID`),
   KEY `filtertypeID` (`filtertypeID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- 
cgit v1.2.3-55-g7522

