kompass/lib/database/kompass_stammesgruppen_teilis.sql

49 lines
3.0 KiB
SQL

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE `%tablename%` (
`id` int NOT NULL AUTO_INCREMENT,
`gruppe_id` int NOT NULL,
`vorname` varchar(128) NOT NULL,
`nachname` varchar(128) NOT NULL,
`geburtsdatum` date DEFAULT NULL,
`strasse` varchar(128) DEFAULT NULL,
`hausnummer` varchar(8) DEFAULT NULL,
`plz` varchar(5) DEFAULT NULL,
`ort` varchar(128) DEFAULT NULL,
`email_1` varchar(512) NOT NULL,
`email_2` varchar(512) DEFAULT NULL,
`telefon_1` varchar(16) NOT NULL,
`telefon_2` varchar(16) DEFAULT NULL,
`badeerlaubnis` enum('complete','partial','none','') NOT NULL,
`allergien` varchar(2048) NOT NULL,
`abholung` enum('alone','parents','other','') NOT NULL,
`abholung_text` varchar(1024) NOT NULL DEFAULT '0',
`foto_socialmedia` tinyint NOT NULL DEFAULT '0',
`foto_print` tinyint NOT NULL DEFAULT '0',
`foto_webseite` tinyint NOT NULL DEFAULT '0',
`foto_partner` tinyint NOT NULL DEFAULT '0',
`halstuch` enum('none','woe','pfadi','rr') NOT NULL DEFAULT 'none',
`anmerkungen` varchar(2048) NOT NULL,
`aufnahmeantrag_da` tinyint NOT NULL DEFAULT '0',
`fotoerlaubnis_da` tinyint NOT NULL DEFAULT '0',
`elterninfo_da` tinyint NOT NULL DEFAULT '0',
`badeerlaubnis_da` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (id)
) %charset%;
ALTER TABLE `%tablename%`
ADD PRIMARY KEY (`id`),
ADD KEY `teili_gruppe` (`gruppe_id`);
ALTER TABLE `%tablename%`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
ALTER TABLE `%tablename%`
ADD CONSTRAINT `teili_gruppe` FOREIGN KEY (`gruppe_id`) REFERENCES `%prefix%kompass_stammesgruppen_gruppen` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;