DROP PROCEDURE IF EXISTS add_tb_column;
DELIMITER $$
CREATE PROCEDURE add_tb_column()
BEGIN
		DECLARE  CurrentDatabase VARCHAR(100);
SELECT DATABASE() INTO CurrentDatabase;


-- fs_user_course_period 表添加 open_comment_status 字段
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS  WHERE TABLE_SCHEMA=CurrentDatabase
				AND TABLE_NAME='fs_user_course_period'
				AND COLUMN_NAME='open_comment_status' )
		THEN
alter table fs_user_course_period add column open_comment_status int COMMENT '开启评论或者弹幕，1-开启评论；2-开启弹幕；3-都关闭';
END IF;

-- qw_external_contact 表添加 comment_status 字段
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS  WHERE TABLE_SCHEMA=CurrentDatabase
				AND TABLE_NAME='qw_external_contact'
				AND COLUMN_NAME='comment_status' )
		THEN
alter table qw_external_contact add column comment_status tinyint COMMENT '看课评论状态，1-拉黑；0-正常';
END IF;


END;

CALL add_tb_column;
DROP PROCEDURE IF EXISTS add_tb_column;
