-- Local dev only. Derived from the real schema, which was provided directly by -- the repo owner (calendars, events, event_versions, and the sessions/users -- tables that step 5 of docs/calendar-auth-migration.md renamed aside). -- -- There is no users or sessions table here: a fresh dev database has no legacy -- accounts to archive, so it starts where production ends up. -- -- Changes made by this repo's own migrations under sql/calendar/ are folded in -- here rather than appended, so a fresh dev container matches production once -- every migration has been applied. Keep the two in step. USE nachklang_calendar; CREATE TABLE `calendars` ( `calendar_id` int(11) NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `includes_calendars` text DEFAULT NULL, PRIMARY KEY (`calendar_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; CREATE TABLE `events` ( `event_id` int(11) NOT NULL AUTO_INCREMENT, `calendar_id` int(11) NOT NULL, `uuid` text NOT NULL, `created_date` datetime DEFAULT current_timestamp(), -- Bridge to the admin module's user ids; see sql/calendar/001_add_admin_user_bridge.sql. `created_by_user_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- Creator name, archived before the legacy users table went away; -- see sql/calendar/002_snapshot_legacy_creator_names.sql. `created_by_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`event_id`), KEY `events_calendars_calendar_id_fk` (`calendar_id`), KEY `events_created_by_user_idx` (`created_by_user_id`), CONSTRAINT `events_calendars_calendar_id_fk` FOREIGN KEY (`calendar_id`) REFERENCES `calendars` (`calendar_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; CREATE TABLE `event_versions` ( `event_version_id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) NOT NULL, `name` text DEFAULT NULL, `description` text DEFAULT NULL, `start_datetime` datetime DEFAULT NULL, `end_datetime` datetime DEFAULT NULL, `whole_day` tinyint(1) DEFAULT NULL, `repeat_frequency` text DEFAULT NULL, `location` text DEFAULT NULL, `url` text DEFAULT NULL, -- Bridge to the admin module's user ids; see sql/calendar/001_add_admin_user_bridge.sql. `version_created_by_user_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- Archived editor name; see sql/calendar/002_snapshot_legacy_creator_names.sql. `version_created_by_name` varchar(255) DEFAULT NULL, `status` text DEFAULT NULL, `version_created_at` datetime DEFAULT current_timestamp(), PRIMARY KEY (`event_version_id`), KEY `event_versions_events_event_id_fk` (`event_id`), KEY `event_versions_created_by_user_idx` (`version_created_by_user_id`), CONSTRAINT `event_versions_events_event_id_fk` FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; INSERT INTO calendars (calendar_id, name, includes_calendars) VALUES (1, 'public', '[]'), (2, 'members', '[]'), (3, 'management', '[]'), (4, 'choir', '[]'), (5, 'birthdays', '[]'); -- Two events carry only an archived creator name, as every pre-cutover event -- does, and one carries an admin user id whose name is resolved live. Dev -- therefore exercises both name sources rather than only one. The one with an -- id is deliberately a PUBLIC event, so the anonymous listing the website uses -- covers both. The id is the dev admin from 04-admin-schema.sql. INSERT INTO events (calendar_id, uuid, created_by_user_id, created_by_name) VALUES (1, UUID(), NULL, 'Dev Admin'), (1, UUID(), 'dev-user-0000-0000-0000-000000000001', NULL), (1, UUID(), NULL, 'Dev Admin'); INSERT INTO event_versions (event_id, name, description, start_datetime, end_datetime, whole_day, location, url, status, version_created_by_user_id, version_created_by_name) VALUES (1, 'Frühlingskonzert 2026', 'Erstes Konzert der Reihe', '2026-04-18 19:00:00', '2026-04-18 21:00:00', 0, 'Musikhochschule, Karlsruhe', 'https://www.nachklang.art/events/fruehlingskonzert-2026', 'PUBLIC', NULL, 'Dev Admin'), (2, 'Sommerkonzert 2026', 'Zweites Konzert der Reihe', '2026-07-11 19:00:00', '2026-07-11 21:00:00', 0, 'Christuskirche, Karlsruhe', 'https://www.nachklang.art/events/sommerkonzert-2026', 'PUBLIC', 'dev-user-0000-0000-0000-000000000001', NULL), (3, 'Adventskonzert 2026', 'Drittes Konzert der Reihe', '2026-12-05 19:00:00', '2026-12-05 21:00:00', 0, 'Stadtkirche, Karlsruhe', 'https://www.nachklang.art/events/adventskonzert-2026', 'DRAFT', NULL, 'Dev Admin');