puzhibing
19 分钟以前 351757b4cc2227bf9a9613d712012fff70815da2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- 预约充电:允许配置多个预约时段。
-- 保留 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` <> '';