ALTER TABLE `tbljob_visits` ADD `schedule_end_date` DATE NULL AFTER `schedule_start_time`;
UPDATE tbljob_visits SET schedule_end_date = schedule_date;
UPDATE tbljob_visits SET schedule_end_date = schedule_date + INTERVAL 1 DAY WHERE NULLIF(schedule_end_time, '') IS NOT NULL AND NULLIF(schedule_start_time, '') IS NOT NULL AND schedule_start_time > schedule_end_time;