CREATE TABLE `event_distance_subscribers` ( 
    `id` INT NOT NULL AUTO_INCREMENT ,
    `subscriber` INT NOT NULL ,
    `event_id` INT NOT NULL ,
    `registration_id` INT NOT NULL ,
    `created_at` TIMESTAMP NOT NULL , 
    PRIMARY KEY (`id`));

ALTER TABLE `event_distance_subscribers`
ADD KEY `fk_event_distance_subscribers_event_id` (`event_id`),
ADD CONSTRAINT `fk_event_distance_subscribers_event_id` FOREIGN KEY (`event_id`) REFERENCES `event` (`event_id`) ON UPDATE CASCADE,
ADD KEY `fk_event_distance_subscribers_user_id` (`subscriber`),
ADD CONSTRAINT `fk_event_distance_subscribers_user_id` FOREIGN KEY (`subscriber`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE,
ADD KEY `fk_event_distance_subscribers_registration_id` (`registration_id`),
ADD CONSTRAINT `fk_event_distance_subscribers_registration_id` FOREIGN KEY (`registration_id`) REFERENCES `event_registration` (`registration_id`) ON UPDATE CASCADE;
