-- 直播场次补充视频时长字段,兼容历史数据允许为空。
|
SET @duration_seconds_column_exists = (
|
SELECT COUNT(*)
|
FROM information_schema.COLUMNS
|
WHERE TABLE_SCHEMA = DATABASE()
|
AND TABLE_NAME = 'tcm_live_session'
|
AND COLUMN_NAME = 'duration_seconds'
|
);
|
|
SET @duration_seconds_alter_sql = IF(
|
@duration_seconds_column_exists = 0,
|
'ALTER TABLE `tcm_live_session` ADD COLUMN `duration_seconds` INT DEFAULT NULL COMMENT ''视频时长(秒)'' AFTER `video_url`',
|
'SELECT 1'
|
);
|
|
PREPARE duration_seconds_stmt FROM @duration_seconds_alter_sql;
|
EXECUTE duration_seconds_stmt;
|
DEALLOCATE PREPARE duration_seconds_stmt;
|