ALTER TABLE `mm_Event` ADD `state` ENUM('closed','reopened') NULL DEFAULT NULL AFTER `showInCalendar`; ALTER TABLE `mm_Event` ADD `end` DATETIME NOT NULL AFTER `endDate`; UPDATE `mm_Event` SET `end` = CONCAT(endDate, ' ', IFNULL((SELECT `endTime` FROM mm_EventTime as et WHERE et.eventId = id AND et.date = endDate), '23:59:59'));