-- Version20260523120000 (up)

CREATE TABLE IF NOT EXISTS `listpickup_route_schedule` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `listpickup_id` INT NOT NULL,
  `fingerprint` VARCHAR(255) NOT NULL,
  `route_date` DATE NOT NULL,
  `start_time` TIME NOT NULL,
  `service_minutes` INT NOT NULL,
  `calculated_at` DATETIME NOT NULL,
  `route_departure_ms` BIGINT NOT NULL,
  `totals` JSON NOT NULL,
  `by_point_id` JSON NOT NULL,
  `created_at` DATETIME NOT NULL,
  `updated_at` DATETIME NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_listpickup_route_schedule_route_fingerprint` (`listpickup_id`, `fingerprint`),
  KEY `idx_listpickup_route_schedule_listpickup_id` (`listpickup_id`),
  CONSTRAINT `FK_listpickup_route_schedule_listpickup` FOREIGN KEY (`listpickup_id`) REFERENCES `listpickup` (`id`) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB;
