-- ----------------------------
-- 教学视频表扩展：支持外部视频源(B站)同步
-- ----------------------------

alter table teaching_video
  add column source_type varchar(32) default null comment '视频来源类型(BILIBILI等)' after video_id,
  add column source_key varchar(64) default null comment '来源唯一键(B站bvid等)' after source_type,
  add column source_url varchar(512) default null comment '来源原始链接' after source_key,
  add column sync_status char(1) default '0' comment '同步状态(0正常 1失败)' after remark,
  add column sync_time datetime default null comment '最近同步时间' after sync_status,
  add column sync_error varchar(500) default null comment '最近同步错误' after sync_time;

create unique index uk_teaching_video_source on teaching_video (source_type, source_key);
create index idx_teaching_video_sync_time on teaching_video (sync_time);

