engelsystem/db/install.sql

568 lines
18 KiB
MySQL
Raw Normal View History

-- phpMyAdmin SQL Dump
2014-01-05 20:04:09 +01:00
-- version 4.0.4.1
-- http://www.phpmyadmin.net
2011-12-18 14:19:42 +01:00
--
-- Host: localhost
2015-07-12 14:45:58 +02:00
-- Erstellungszeit: 12. Jul 2015 um 14:45
2014-01-05 20:04:09 +01:00
-- Server Version: 5.6.12
-- PHP-Version: 5.5.3
2014-01-05 20:04:09 +01:00
SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
2011-12-18 14:19:42 +01:00
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `AngelTypes`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `AngelTypes`;
CREATE TABLE IF NOT EXISTS `AngelTypes` (
2011-12-26 16:25:39 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL DEFAULT '',
`restricted` int(1) NOT NULL,
2014-03-09 13:12:46 +01:00
`description` text NOT NULL,
2011-12-26 16:25:39 +01:00
PRIMARY KEY (`id`),
UNIQUE KEY `Name` (`name`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
2014-03-09 13:12:46 +01:00
--
-- Daten für Tabelle `AngelTypes`
--
INSERT INTO `AngelTypes` (`id`, `name`, `restricted`, `description`) VALUES
2014-12-07 20:31:40 +01:00
(1, 'testengel', 1, '# Überschrift in Ebene 1\n\n#### Überschrift in Ebene 4\n\n[Beschriftung des Hyperlinks](http://de.wikipedia.org/ "Titel, der beim Überfahren mit der Maus angezeigt wird")');
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
2014-01-05 20:04:09 +01:00
-- Tabellenstruktur für Tabelle `GroupPrivileges`
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `GroupPrivileges`;
2014-01-05 20:04:09 +01:00
CREATE TABLE IF NOT EXISTS `GroupPrivileges` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`privilege_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id` (`group_id`,`privilege_id`),
KEY `privilege_id` (`privilege_id`)
2014-12-25 22:28:39 +01:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=258 ;
2014-01-05 20:04:09 +01:00
--
-- Daten für Tabelle `GroupPrivileges`
--
INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES
(85, -6, 10),
(87, -6, 18),
(86, -6, 21),
(216, -5, 5),
(212, -5, 6),
(207, -5, 7),
(211, -5, 12),
(208, -5, 13),
(210, -5, 14),
(214, -5, 16),
(209, -5, 21),
(213, -5, 28),
(206, -5, 31),
(215, -5, 33),
2014-12-25 22:28:39 +01:00
(257, -5, 38),
2014-01-05 20:04:09 +01:00
(219, -4, 14),
(221, -4, 25),
(220, -4, 33),
(241, -3, 5),
(238, -3, 14),
(240, -3, 16),
(237, -3, 19),
(242, -3, 25),
(235, -3, 27),
(239, -3, 28),
(236, -3, 32),
(247, -2, 3),
(246, -2, 4),
(255, -2, 8),
(252, -2, 9),
(254, -2, 11),
(248, -2, 15),
(251, -2, 17),
(256, -2, 24),
(253, -2, 26),
(245, -2, 30),
(244, -2, 34),
(249, -2, 35),
(243, -2, 36),
(250, -2, 37),
(88, -1, 1),
(23, -1, 2),
(24, -1, 5);
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `Groups`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `Groups`;
CREATE TABLE IF NOT EXISTS `Groups` (
2011-12-18 14:19:42 +01:00
`Name` varchar(35) NOT NULL,
`UID` int(11) NOT NULL,
PRIMARY KEY (`UID`)
2014-01-05 20:04:09 +01:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2011-12-18 14:19:42 +01:00
--
-- Daten für Tabelle `Groups`
--
INSERT INTO `Groups` (`Name`, `UID`) VALUES
('6-Developer', -6),
2014-01-05 20:04:09 +01:00
('5-Erzengel', -5),
('4-Team Coordinator', -4),
('3-Shift Coordinator', -3),
('2-Engel', -2),
('1-Gast', -1);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `LogEntries`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `LogEntries`;
CREATE TABLE IF NOT EXISTS `LogEntries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timestamp` int(11) NOT NULL,
2015-05-14 16:36:32 +02:00
`nick` text NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`),
KEY `timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `Messages`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `Messages`;
CREATE TABLE IF NOT EXISTS `Messages` (
2011-12-18 14:19:42 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`Datum` int(11) NOT NULL,
`SUID` int(11) NOT NULL DEFAULT '0',
`RUID` int(11) NOT NULL DEFAULT '0',
`isRead` char(1) NOT NULL DEFAULT 'N',
`Text` text NOT NULL,
PRIMARY KEY (`id`),
KEY `Datum` (`Datum`),
KEY `SUID` (`SUID`),
KEY `RUID` (`RUID`)
2014-01-05 20:04:09 +01:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Fuers interen Communikationssystem' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `NeededAngelTypes`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `NeededAngelTypes`;
CREATE TABLE IF NOT EXISTS `NeededAngelTypes` (
2011-12-18 14:19:42 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`room_id` int(11) DEFAULT NULL,
`shift_id` int(11) DEFAULT NULL,
`angel_type_id` int(11) NOT NULL,
`count` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `room_id` (`room_id`,`angel_type_id`),
2014-01-05 20:04:09 +01:00
KEY `shift_id` (`shift_id`),
KEY `angel_type_id` (`angel_type_id`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `News`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `News`;
CREATE TABLE IF NOT EXISTS `News` (
2011-12-18 14:19:42 +01:00
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Datum` int(11) NOT NULL,
`Betreff` varchar(150) NOT NULL DEFAULT '',
`Text` text NOT NULL,
`UID` int(11) NOT NULL DEFAULT '0',
`Treffen` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
2012-12-01 11:59:49 +01:00
KEY `UID` (`UID`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
2014-01-05 20:04:09 +01:00
-- Tabellenstruktur für Tabelle `NewsComments`
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `NewsComments`;
2014-01-05 20:04:09 +01:00
CREATE TABLE IF NOT EXISTS `NewsComments` (
`ID` bigint(11) NOT NULL AUTO_INCREMENT,
`Refid` int(11) NOT NULL DEFAULT '0',
`Datum` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Text` text NOT NULL,
`UID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
KEY `Refid` (`Refid`),
KEY `UID` (`UID`)
2014-03-09 13:12:46 +01:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `Privileges`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `Privileges`;
CREATE TABLE IF NOT EXISTS `Privileges` (
2011-12-18 14:19:42 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`desc` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
2014-12-25 22:28:39 +01:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=39 ;
2011-12-18 14:19:42 +01:00
--
-- Daten für Tabelle `Privileges`
2011-12-18 14:19:42 +01:00
--
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES
(1, 'start', 'Startseite für Gäste/Nicht eingeloggte User'),
(2, 'login', 'Logindialog'),
(3, 'news', 'Anzeigen der News-Seite'),
(4, 'logout', 'User darf sich ausloggen'),
(5, 'register', 'Einen neuen Engel registerieren'),
(6, 'admin_rooms', 'Räume administrieren'),
(7, 'admin_angel_types', 'Engel Typen administrieren'),
(8, 'user_settings', 'User profile settings'),
(9, 'user_messages', 'Writing and reading messages from user to user'),
(10, 'admin_groups', 'Manage usergroups and their rights'),
(11, 'user_questions', 'Let users ask questions'),
(12, 'admin_questions', 'Answer user''s questions'),
2014-01-05 20:04:09 +01:00
(13, 'admin_faq', 'Edit FAQs'),
(14, 'admin_news', 'Administrate the news section'),
(15, 'news_comments', 'User can comment news'),
(16, 'admin_user', 'Administrate the angels'),
(17, 'user_meetings', 'Lists meetings (news)'),
(18, 'admin_language', 'Translate the system'),
(19, 'admin_log', 'Display recent changes'),
(20, 'user_wakeup', 'User wakeup-service organization'),
(21, 'admin_import', 'Import rooms and shifts from pentabarf'),
(22, 'credits', 'View credits'),
2014-01-05 20:04:09 +01:00
(23, 'faq', 'View FAQ'),
(24, 'user_shifts', 'Signup for shifts'),
(25, 'user_shifts_admin', 'Signup other angels for shifts.'),
(26, 'user_myshifts', 'Allow angels to view their own shifts and cancel them.'),
(27, 'admin_arrive', 'Mark angels when they arrive.'),
(28, 'admin_shifts', 'Create shifts'),
(30, 'ical', 'iCal shift export'),
(31, 'admin_active', 'Mark angels as active and if they got a t-shirt.'),
(32, 'admin_free', 'Show a list of free/unemployed angels.'),
(33, 'admin_user_angeltypes', 'Confirm restricted angel types'),
(34, 'atom', ' Atom news export'),
2014-01-05 20:04:09 +01:00
(35, 'shifts_json_export', 'Export shifts in JSON format'),
(36, 'angeltypes', 'View angeltypes'),
2014-12-25 22:28:39 +01:00
(37, 'user_angeltypes', 'Join angeltypes.'),
(38, 'shifttypes', 'Administrate shift types');
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `Questions`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `Questions`;
CREATE TABLE IF NOT EXISTS `Questions` (
2011-12-18 14:19:42 +01:00
`QID` bigint(20) NOT NULL AUTO_INCREMENT,
`UID` int(11) NOT NULL DEFAULT '0',
`Question` text NOT NULL,
`AID` int(11) DEFAULT NULL,
`Answer` text,
2012-12-01 11:59:49 +01:00
PRIMARY KEY (`QID`),
KEY `UID` (`UID`),
KEY `AID` (`AID`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Fragen und Antworten' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `Room`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `Room`;
CREATE TABLE IF NOT EXISTS `Room` (
2011-12-18 14:19:42 +01:00
`RID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(35) NOT NULL DEFAULT '',
`Man` text,
`FromPentabarf` char(1) NOT NULL DEFAULT 'N',
`show` char(1) NOT NULL DEFAULT 'Y',
`Number` int(11) DEFAULT NULL,
PRIMARY KEY (`RID`),
UNIQUE KEY `Name` (`Name`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `ShiftEntry`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `ShiftEntry`;
CREATE TABLE IF NOT EXISTS `ShiftEntry` (
2011-12-18 14:19:42 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`SID` int(11) NOT NULL DEFAULT '0',
`TID` int(11) NOT NULL DEFAULT '0',
`UID` int(11) NOT NULL DEFAULT '0',
`Comment` text,
2014-01-05 20:04:09 +01:00
`freeload_comment` text,
`freeloaded` tinyint(1) NOT NULL,
2012-12-01 11:59:49 +01:00
PRIMARY KEY (`id`),
KEY `TID` (`TID`),
KEY `UID` (`UID`),
2014-01-05 20:04:09 +01:00
KEY `SID` (`SID`,`TID`),
KEY `freeloaded` (`freeloaded`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `Shifts`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `Shifts`;
CREATE TABLE IF NOT EXISTS `Shifts` (
2011-12-18 14:19:42 +01:00
`SID` int(11) NOT NULL AUTO_INCREMENT,
2014-12-25 22:28:39 +01:00
`title` text,
`shifttype_id` int(11) NOT NULL,
2011-12-18 14:19:42 +01:00
`start` int(11) NOT NULL,
`end` int(11) NOT NULL,
`RID` int(11) NOT NULL DEFAULT '0',
`URL` text,
`PSID` int(11) DEFAULT NULL,
PRIMARY KEY (`SID`),
2012-12-01 11:59:49 +01:00
UNIQUE KEY `PSID` (`PSID`),
2014-12-25 22:28:39 +01:00
KEY `RID` (`RID`),
KEY `shifttype_id` (`shifttype_id`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
2014-12-25 22:28:39 +01:00
--
-- Tabellenstruktur für Tabelle `ShiftTypes`
--
DROP TABLE IF EXISTS `ShiftTypes`;
CREATE TABLE IF NOT EXISTS `ShiftTypes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`angeltype_id` int(11) DEFAULT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`),
KEY `angeltype_id` (`angeltype_id`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- Daten für Tabelle `ShiftTypes`
--
INSERT INTO `ShiftTypes` (`id`, `name`, `angeltype_id`, `description`) VALUES
(4, 'asdf', NULL, '');
2014-12-25 22:28:39 +01:00
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `User`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `User`;
CREATE TABLE IF NOT EXISTS `User` (
2011-12-18 14:19:42 +01:00
`UID` int(11) NOT NULL AUTO_INCREMENT,
`Nick` varchar(23) NOT NULL DEFAULT '',
`Name` varchar(23) DEFAULT NULL,
`Vorname` varchar(23) DEFAULT NULL,
`Alter` int(4) DEFAULT NULL,
`Telefon` varchar(40) DEFAULT NULL,
`DECT` varchar(5) DEFAULT NULL,
`Handy` varchar(40) DEFAULT NULL,
`email` varchar(123) DEFAULT NULL,
2014-12-07 20:31:40 +01:00
`email_shiftinfo` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'User wants to be informed by mail about changes in his shifts',
2011-12-18 14:19:42 +01:00
`jabber` varchar(200) DEFAULT NULL,
`Size` varchar(4) DEFAULT NULL,
`Passwort` varchar(128) DEFAULT NULL,
2014-01-05 20:04:09 +01:00
`password_recovery_token` varchar(32) DEFAULT NULL,
2011-12-18 14:19:42 +01:00
`Gekommen` tinyint(4) NOT NULL DEFAULT '0',
`Aktiv` tinyint(4) NOT NULL DEFAULT '0',
2014-01-05 20:04:09 +01:00
`force_active` tinyint(1) NOT NULL,
2011-12-18 14:19:42 +01:00
`Tshirt` tinyint(4) DEFAULT '0',
`color` tinyint(4) DEFAULT '10',
2014-01-05 20:04:09 +01:00
`Sprache` char(64) NOT NULL,
2011-12-18 14:19:42 +01:00
`Menu` char(1) NOT NULL DEFAULT 'L',
`lastLogIn` int(11) NOT NULL,
`CreateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Art` varchar(30) DEFAULT NULL,
`kommentar` text,
`Hometown` varchar(255) NOT NULL DEFAULT '',
`api_key` varchar(32) NOT NULL,
2015-05-14 16:26:14 +02:00
`got_voucher` tinyint(1) NOT NULL,
2015-07-12 14:45:58 +02:00
`arrival_date` int(11) DEFAULT NULL,
`planned_arrival_date` int(11) NOT NULL,
2014-01-05 20:04:09 +01:00
PRIMARY KEY (`UID`),
2011-12-18 14:19:42 +01:00
UNIQUE KEY `Nick` (`Nick`),
2014-01-05 20:04:09 +01:00
KEY `api_key` (`api_key`),
KEY `password_recovery_token` (`password_recovery_token`),
2015-07-12 14:45:58 +02:00
KEY `force_active` (`force_active`),
KEY `arrival_date` (`arrival_date`,`planned_arrival_date`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
2011-12-18 14:19:42 +01:00
--
-- Daten für Tabelle `User`
2011-12-18 14:19:42 +01:00
--
2015-07-12 14:45:58 +02:00
INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `email_shiftinfo`, `jabber`, `Size`, `Passwort`, `password_recovery_token`, `Gekommen`, `Aktiv`, `force_active`, `Tshirt`, `color`, `Sprache`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`, `api_key`, `got_voucher`, `arrival_date`, `planned_arrival_date`) VALUES
(1, 'admin', 'Gates', 'Bill', 42, '', '-', '', 'admin@example.com', 0, '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 0, 0, 0, 2, 'de_DE.UTF-8', 'L', 1436705059, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235', 0, NULL, 0);
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
2012-12-01 11:59:49 +01:00
--
-- Tabellenstruktur für Tabelle `UserAngelTypes`
2012-12-01 11:59:49 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `UserAngelTypes`;
CREATE TABLE IF NOT EXISTS `UserAngelTypes` (
2012-12-01 11:59:49 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`angeltype_id` int(11) NOT NULL,
`confirm_user_id` int(11) DEFAULT NULL,
`coordinator` tinyint(1) NOT NULL,
2012-12-01 11:59:49 +01:00
PRIMARY KEY (`id`),
2014-01-05 20:04:09 +01:00
KEY `user_id` (`user_id`,`angeltype_id`,`confirm_user_id`),
KEY `angeltype_id` (`angeltype_id`),
KEY `confirm_user_id` (`confirm_user_id`),
KEY `coordinator` (`coordinator`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
2014-12-07 20:31:40 +01:00
--
-- Daten für Tabelle `UserAngelTypes`
--
INSERT INTO `UserAngelTypes` (`id`, `user_id`, `angeltype_id`, `confirm_user_id`, `coordinator`) VALUES
(15, 1, 1, 1, 1);
-- --------------------------------------------------------
2011-12-18 14:19:42 +01:00
--
-- Tabellenstruktur für Tabelle `UserGroups`
2011-12-18 14:19:42 +01:00
--
2014-12-07 20:31:40 +01:00
DROP TABLE IF EXISTS `UserGroups`;
CREATE TABLE IF NOT EXISTS `UserGroups` (
2011-12-18 14:19:42 +01:00
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
2014-01-05 20:04:09 +01:00
KEY `uid` (`uid`,`group_id`),
KEY `group_id` (`group_id`)
2015-05-14 16:26:14 +02:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
2011-12-18 14:19:42 +01:00
--
-- Daten für Tabelle `UserGroups`
2011-12-18 14:19:42 +01:00
--
INSERT INTO `UserGroups` (`id`, `uid`, `group_id`) VALUES
(3, 1, -6),
(4, 1, -5),
(12, 1, -4),
2014-01-05 20:04:09 +01:00
(2, 1, -3),
(1, 1, -2);
2014-01-05 20:04:09 +01:00
--
-- Constraints der exportierten Tabellen
--
--
2014-01-05 20:04:09 +01:00
-- Constraints der Tabelle `GroupPrivileges`
2011-12-18 14:19:42 +01:00
--
2014-01-05 20:04:09 +01:00
ALTER TABLE `GroupPrivileges`
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `groupprivileges_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `groupprivileges_ibfk_2` FOREIGN KEY (`privilege_id`) REFERENCES `Privileges` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
2011-12-18 14:19:42 +01:00
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `Messages`
--
ALTER TABLE `Messages`
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`SUID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`RUID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `NeededAngelTypes`
--
ALTER TABLE `NeededAngelTypes`
ADD CONSTRAINT `neededangeltypes_ibfk_1` FOREIGN KEY (`room_id`) REFERENCES `Room` (`RID`) ON DELETE CASCADE ON UPDATE CASCADE,
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `neededangeltypes_ibfk_2` FOREIGN KEY (`shift_id`) REFERENCES `Shifts` (`SID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `neededangeltypes_ibfk_3` FOREIGN KEY (`angel_type_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `News`
--
ALTER TABLE `News`
ADD CONSTRAINT `news_ibfk_1` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints der Tabelle `NewsComments`
--
ALTER TABLE `NewsComments`
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `newscomments_ibfk_1` FOREIGN KEY (`Refid`) REFERENCES `News` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `newscomments_ibfk_2` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `Questions`
--
ALTER TABLE `Questions`
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `questions_ibfk_2` FOREIGN KEY (`AID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
2011-12-18 14:19:42 +01:00
--
2014-01-05 20:04:09 +01:00
-- Constraints der Tabelle `ShiftEntry`
2011-12-18 14:19:42 +01:00
--
2014-01-05 20:04:09 +01:00
ALTER TABLE `ShiftEntry`
ADD CONSTRAINT `shiftentry_ibfk_1` FOREIGN KEY (`SID`) REFERENCES `Shifts` (`SID`) ON DELETE CASCADE ON UPDATE CASCADE,
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `shiftentry_ibfk_2` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `shiftentry_ibfk_3` FOREIGN KEY (`TID`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
2011-12-18 14:19:42 +01:00
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `Shifts`
--
ALTER TABLE `Shifts`
2014-12-25 22:28:39 +01:00
ADD CONSTRAINT `shifts_ibfk_1` FOREIGN KEY (`RID`) REFERENCES `Room` (`RID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `shifts_ibfk_2` FOREIGN KEY (`shifttype_id`) REFERENCES `ShiftTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints der Tabelle `ShiftTypes`
--
ALTER TABLE `ShiftTypes`
ADD CONSTRAINT `shifttypes_ibfk_1` FOREIGN KEY (`angeltype_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `UserAngelTypes`
--
ALTER TABLE `UserAngelTypes`
ADD CONSTRAINT `userangeltypes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
2014-03-09 13:12:46 +01:00
ADD CONSTRAINT `userangeltypes_ibfk_2` FOREIGN KEY (`angeltype_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `userangeltypes_ibfk_3` FOREIGN KEY (`confirm_user_id`) REFERENCES `User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE;
2014-01-05 20:04:09 +01:00
--
-- Constraints der Tabelle `UserGroups`
--
ALTER TABLE `UserGroups`
ADD CONSTRAINT `usergroups_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `usergroups_ibfk_2` FOREIGN KEY (`uid`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
SET FOREIGN_KEY_CHECKS=1;