# 无人机维修设备更换记录
create table uav_device_replace_record
(
    id                 int primary key auto_increment comment '主键id',
    repair_record_id     int         not null comment '维修记录id',
    old_device_id      int         not null comment '旧设备id',
    new_device_id      int         not null comment '新设备id',
    is_replace         tinyint     not null comment '是否更换设备: 0-否, 1-是',
    create_time        datetime,
    update_time        datetime,

    key idx_repair_id (repair_record_id),

    # // TODO 2025/6/4: 删除物理外键
    foreign key (repair_record_id) references device_repair_record (id),
    foreign key (old_device_id) references device_info (id),
    foreign key (new_device_id) references device_info (id)
) comment '维修更换设备记录表';