-- 预约充电:允许配置多个预约时段。
|
-- 保留 reservation_start_time / reservation_end_time 并同步第一段,便于旧版本回滚兼容。
|
ALTER TABLE `t_site`
|
ADD COLUMN `reservation_time_ranges` JSON NULL COMMENT '允许预约时段JSON数组' AFTER `reservation_end_time`;
|
|
UPDATE `t_site`
|
SET `reservation_time_ranges` = JSON_ARRAY(
|
JSON_OBJECT(
|
'startTime', `reservation_start_time`,
|
'endTime', `reservation_end_time`
|
)
|
)
|
WHERE `reservation_time_ranges` IS NULL
|
AND `reservation_start_time` IS NOT NULL
|
AND `reservation_start_time` <> ''
|
AND `reservation_end_time` IS NOT NULL
|
AND `reservation_end_time` <> '';
|