summaryrefslogtreecommitdiffstats
path: root/setup
diff options
context:
space:
mode:
authorSebastian Wagner2011-06-24 16:13:47 +0200
committerSebastian Wagner2011-06-24 16:13:47 +0200
commit83edc76321c3662d44b377d3a57d252a639ee833 (patch)
treea86161d8382363e5a500692f2ab5b11dbedd2128 /setup
parentchange start- and end-type to timestamp (diff)
downloadpbs2-83edc76321c3662d44b377d3a57d252a639ee833.tar.gz
pbs2-83edc76321c3662d44b377d3a57d252a639ee833.tar.xz
pbs2-83edc76321c3662d44b377d3a57d252a639ee833.zip
some timec-onstraints
Diffstat (limited to 'setup')
-rw-r--r--setup/poolctrl.sql12
1 files changed, 7 insertions, 5 deletions
diff --git a/setup/poolctrl.sql b/setup/poolctrl.sql
index 26efc92..010e76c 100644
--- a/setup/poolctrl.sql
+++ b/setup/poolctrl.sql
@@ -6,8 +6,8 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE TABLE IF NOT EXISTS `poolctrl_event` (
`eventID` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
- `start` timestamp COLLATE utf8_unicode_ci NOT NULL DEFAULT CURRENT_TIMESTAMP(),
+ `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
+ `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 NOT NULL,
@@ -86,6 +86,8 @@ CREATE TABLE IF NOT EXISTS `pbs_poolentries` (
ALTER TABLE `pbs_poolentries` ADD CONSTRAINT `pbs_poolentries_ibfk_1` FOREIGN KEY (`poolID`) REFERENCES `pbs_pool` (`poolID`) ON DELETE CASCADE;
-ALTER TABLE `poolctrl_event` ADD CONSTRAINT `poolctrl_event_c1` FOREIGN KEY (`pbs_poolID`) REFERENCES `pbs_pool` (`poolID`) ON DELETE CASCADE,
- ADD CONSTRAINT `poolctrl_event_c2` FOREIGN KEY (`pbs_personID`) REFERENCES `pbs_person` (`personID`) ON DELETE CASCADE,
- ADD CONSTRAINT `poolctrl_event_c3` FOREIGN KEY (`pbs_bootisoID`) REFERENCES `pbs_bootiso` (`bootisoID`) 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_personidC` FOREIGN KEY (`pbs_personID`) REFERENCES `pbs_person` (`personID`) ON DELETE CASCADE,
+ ADD CONSTRAINT `poolctrl_event_boolisoidC` FOREIGN KEY (`pbs_bootisoID`) REFERENCES `pbs_bootiso` (`bootisoID`) ON DELETE CASCADE,
+ ADD CONSTRAINT `poolctrl_event_startC` CHECK (DATEDIFF(`start`, CURRENT_TIMESTAMP()) > 0),
+ ADD CONSTRAINT `poolctrl_event_endC` CHECK (DATEDIFF(`end`, `start`) > 0);