-- =============================================
-- 数据库迁移脚本：为 delivery 表添加缺失的照片和视频字段
-- 用途：存储到地相关的照片和视频
-- 创建时间：2025-10-28
-- 数据库：MySQL
-- =============================================

-- 添加到地纸质磅单（双章）照片字段
ALTER TABLE delivery 
ADD COLUMN destination_pound_list_img VARCHAR(500) COMMENT '到地纸质磅单（双章）' 
AFTER driver_id_card_photo;

-- 添加到地车辆过重磅车头照片字段
ALTER TABLE delivery 
ADD COLUMN destination_vehicle_front_photo VARCHAR(500) COMMENT '到地车辆过重磅车头照片' 
AFTER destination_pound_list_img;

-- 添加装牛视频字段
ALTER TABLE delivery 
ADD COLUMN cattle_loading_video VARCHAR(500) COMMENT '装牛视频' 
AFTER cattle_loading_circle_video;

-- 添加卸牛视频字段
ALTER TABLE delivery 
ADD COLUMN unload_cattle_video VARCHAR(500) COMMENT '卸牛视频' 
AFTER cattle_loading_video;

-- 添加到地过磅视频字段
ALTER TABLE delivery 
ADD COLUMN destination_weight_video VARCHAR(500) COMMENT '到地过磅视频' 
AFTER unload_cattle_video;

-- 验证字段是否添加成功
SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT, COLUMN_COMMENT 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_SCHEMA = DATABASE() 
  AND TABLE_NAME = 'delivery' 
  AND COLUMN_NAME IN (
    'destination_pound_list_img',
    'destination_vehicle_front_photo',
    'cattle_loading_video',
    'unload_cattle_video',
    'destination_weight_video'
  );

-- 显示完整的表结构
DESCRIBE delivery;

