功能:更新 YumiNail 用户端流程
This commit is contained in:
@@ -85,6 +85,8 @@ create table t_comment
|
||||
product_id bigint unsigned default 0 null comment '关联商品表主键(0表示非商品评论)',
|
||||
comment_content text not null comment '评论内容',
|
||||
parent_comment_id bigint unsigned default 0 null comment '父级评论ID(0表示为根评论)',
|
||||
rating_score tinyint unsigned default 5 null comment '评论评分:1-5星',
|
||||
image_file_ids text null comment '评论图片文件ID集合,多个ID以逗号分隔',
|
||||
like_count int unsigned default 0 null comment '评论点赞数',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '评论创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '评论更新时间',
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE PROCEDURE sp_add_column_if_not_exists(
|
||||
IN p_table_name VARCHAR(64),
|
||||
IN p_column_name VARCHAR(64),
|
||||
IN p_definition TEXT
|
||||
)
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = p_table_name
|
||||
AND COLUMN_NAME = p_column_name
|
||||
) THEN
|
||||
SET @sql = CONCAT('ALTER TABLE `', p_table_name, '` ADD COLUMN `', p_column_name, '` ', p_definition);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
CALL sp_add_column_if_not_exists('t_comment', 'rating_score', 'tinyint unsigned DEFAULT 5 NULL COMMENT ''评论评分:1-5星'' AFTER `parent_comment_id`');
|
||||
CALL sp_add_column_if_not_exists('t_comment', 'image_file_ids', 'text NULL COMMENT ''评论图片文件ID集合,多个ID以逗号分隔'' AFTER `rating_score`');
|
||||
|
||||
DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists;
|
||||
Reference in New Issue
Block a user