Files
wucaixing-backend/sql/alter_hot_driver_vehicle_ids_20260522.sql
2026-05-23 10:14:33 +08:00

15 lines
488 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ALTER TABLE hot_driver
ADD COLUMN vehicle_ids VARCHAR(1000) NULL COMMENT '已绑定车辆ID集合多个以逗号分隔' AFTER vehicle_id;
UPDATE hot_driver
SET vehicle_ids = NULLIF(TRIM(vehicle_id), '')
WHERE vehicle_ids IS NULL
AND vehicle_id IS NOT NULL;
UPDATE hot_driver
SET vehicle_id = NULLIF(SUBSTRING_INDEX(vehicle_ids, ',', 1), ''),
plate_number = NULLIF(SUBSTRING_INDEX(plate_number, ',', 1), '');
ALTER TABLE hot_driver
DROP COLUMN current_page_vehicle_id;