-- Apply after 202609240010. Retain historical slugs when changing names later.
-- Existing unit_domains_or_slugs holds retained unit slugs.
CREATE TABLE public_event_slug_redirects (
 unit_id BIGINT UNSIGNED NOT NULL,
 old_slug VARCHAR(100) NOT NULL,
 event_id BIGINT UNSIGNED NOT NULL,
 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY(unit_id,old_slug),
 KEY idx_event_slug_redirect_event(event_id),
 CONSTRAINT fk_public_event_slug_unit FOREIGN KEY(unit_id) REFERENCES units(id) ON DELETE CASCADE,
 CONSTRAINT fk_public_event_slug_event FOREIGN KEY(event_id) REFERENCES meetings(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
