-- 修复MovingObjectType枚举不匹配问题
-- 将AIRPORT_VEHICLE替换为SPECIAL_VEHICLE和NORMAL_VEHICLE

-- 更新停机坪限速规则的车辆类型
DELETE FROM "public"."spatial_rule_vehicle_types" 
WHERE "rule_id" = 'SPEED_LIMIT_APRON' AND "vehicle_type" = 'AIRPORT_VEHICLE';

-- 如果SPECIAL_VEHICLE不存在，添加它
INSERT INTO "public"."spatial_rule_vehicle_types" ("rule_id", "vehicle_type") 
VALUES ('SPEED_LIMIT_APRON', 'SPECIAL_VEHICLE')
ON CONFLICT ("rule_id", "vehicle_type") DO NOTHING;

-- 更新滑行道限速规则的车辆类型
DELETE FROM "public"."spatial_rule_vehicle_types" 
WHERE "rule_id" = 'SPEED_LIMIT_TAXIWAY' AND "vehicle_type" = 'AIRPORT_VEHICLE';

-- 如果SPECIAL_VEHICLE不存在，添加它
INSERT INTO "public"."spatial_rule_vehicle_types" ("rule_id", "vehicle_type") 
VALUES ('SPEED_LIMIT_TAXIWAY', 'SPECIAL_VEHICLE')
ON CONFLICT ("rule_id", "vehicle_type") DO NOTHING;

-- 验证更新结果
SELECT rule_id, vehicle_type 
FROM "public"."spatial_rule_vehicle_types" 
WHERE rule_id IN ('SPEED_LIMIT_APRON', 'SPEED_LIMIT_TAXIWAY') 
ORDER BY rule_id, vehicle_type;