SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;

CREATE TABLE `%tablename%` (
                               `id` int NOT NULL AUTO_INCREMENT,
                               `eventId` int NOT NULL,
                               `group_name` varchar(1024) NOT NULL,
                               `max_participants` int NOT NULL,
                               `amount_reduced` decimal(8,2) DEFAULT NULL,
                               `amount_default` decimal(8,2) DEFAULT NULL,
                               `amount_social` decimal(8,2) DEFAULT NULL,
                               PRIMARY KEY  (id)

) %charset%;


ALTER TABLE `%tablename%`
    ADD PRIMARY KEY (`id`),
    ADD KEY `event_group` (`eventId`);


ALTER TABLE `%tablename%`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `%tablename%`
    ADD CONSTRAINT `event_group` FOREIGN KEY (`eventId`) REFERENCES `%prefix%kompass_veranstaltungen_index` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;

COMMIT;
