Commit 855bf991 authored by Michael Koch's avatar Michael Koch
Browse files

Fixed foreign key constraint fails, also one breaking typo

parent c8365aa8
......@@ -134,11 +134,28 @@ CREATE TABLE `login_attempts` (
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ALTER TABLE `rooms`
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `refreshment_categories`
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `offenders`
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `users`
ADD UNIQUE KEY `username` (`username`),
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `reservations`
ADD PRIMARY KEY (`id`),
ADD INDEX (from_reservation),
ADD INDEX (from_preparation),
ADD INDEX (from_event),
ADD INDEX (to_reservation),
ADD INDEX (to_preparation),
ADD INDEX (to_event),
ADD INDEX (confirmed),
ADD INDEX (denied),
......@@ -153,10 +170,6 @@ ALTER TABLE `reservation_signage`
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
ADD CONSTRAINT `reservation_signage_foreign_key_reservation_id` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`) ON DELETE CASCADE;
ALTER TABLE `rooms`
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `refreshments`
ADD PRIMARY KEY (`id`),
ADD KEY `refreshments_foreign_key_category_id` (`category_id`),
......@@ -171,10 +184,6 @@ ALTER TABLE `refreshment_orders`
ADD CONSTRAINT `refreshment_orders_foreign_key_reservation_id` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `refreshment_orders_foreign_key_refreshment_id` FOREIGN KEY (`refreshment_id`) REFERENCES `refreshments` (`id`) ON DELETE CASCADE;
ALTER TABLE `refreshment_categories`
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `offenses`
ADD PRIMARY KEY (`id`),
ADD KEY `offenses_foreign_key_offender_id` (`offender_id`),
......@@ -183,15 +192,6 @@ ALTER TABLE `offenses`
ADD CONSTRAINT `offenses_foreign_key_assignment_id` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `offenses_foreign_key_offender_id` FOREIGN KEY (`offender_id`) REFERENCES `offenders` (`id`) ON DELETE CASCADE;
ALTER TABLE `offenders`
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `users`
ADD UNIQUE KEY `username` (`username`),
ADD PRIMARY KEY (`id`),
MODIFY `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `user_roles`
ADD PRIMARY KEY (`id`),
ADD KEY `user_roles_foreign_key_user_id` (`user_id`),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment