Tour Guide, mehrere Tour-Bilder und Guide-Verwaltungsrechte

This commit is contained in:
torsten 2026-11-08 17:24:41 +01:00
parent 322d232012
commit b52155c5f0
12 changed files with 784 additions and 154 deletions

View file

@ -71,6 +71,18 @@ MIGRATIONS = [
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci''',
# tours.user_id -> tours.tour_guide_id umbenennen (idempotent)
'''SET @has_user := (SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'tours' AND COLUMN_NAME = 'user_id');
SET @has_guide := (SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'tours' AND COLUMN_NAME = 'tour_guide_id');
SET @sql := IF(@has_user > 0 AND @has_guide = 0,
'ALTER TABLE `tours` CHANGE `user_id` `tour_guide_id` INT NOT NULL',
'DO 0');
PREPARE mig_stmt FROM @sql;
EXECUTE mig_stmt;
DEALLOCATE PREPARE mig_stmt''',
]