SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;

CREATE TABLE `%tablename%` (
                                                     `id` int NOT NULL AUTO_INCREMENT,
                                                     `gruppen_name` varchar(256) COLLATE utf8mb4_unicode_520_ci NOT NULL,
                                                     `gruppe_grufue` bigint UNSIGNED DEFAULT NULL,
                                                     PRIMARY KEY  (id)

) %charset%;


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


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

ALTER TABLE `%tablename%` ADD CONSTRAINT `gruppe_grufue` FOREIGN KEY (`gruppe_grufue`) REFERENCES `%prefix%users`(`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
