-- 为 cms_app 表新增发布管理相关字段
-- 执行前请确认已连接正确的数据库

ALTER TABLE `cms_app`
    ADD COLUMN `publish_status`    VARCHAR(20)    NULL DEFAULT 'developing' COMMENT '发布状态: developing开发中 pending_review待审核 published已上架 rejected审核未通过 deprecated已下架' AFTER `market`,
    ADD COLUMN `price_type`        VARCHAR(20)    NULL COMMENT '定价模式: free免费 one_time一次性 subscription订阅' AFTER `publish_status`,
    ADD COLUMN `subscription_period` VARCHAR(10)  NULL COMMENT '订阅周期: month按月 year按年' AFTER `price_type`,
    ADD COLUMN `app_description`   VARCHAR(500)   NULL COMMENT '应用简介（市场展示用）' AFTER `subscription_period`,
    ADD COLUMN `detail_description` TEXT          NULL COMMENT '详细说明（富文本）' AFTER `app_description`,
    ADD COLUMN `screenshots`       TEXT           NULL COMMENT '应用截图（JSON数组字符串）' AFTER `detail_description`,
    ADD COLUMN `install_count`     INT            NULL DEFAULT 0 COMMENT '安装/使用次数' AFTER `screenshots`,
    ADD COLUMN `rating`            DECIMAL(3,1)   NULL DEFAULT 0.0 COMMENT '评分（1-5）' AFTER `install_count`,
    ADD COLUMN `reject_reason`     VARCHAR(500)   NULL COMMENT '审核拒绝原因' AFTER `rating`,
    ADD COLUMN `publish_apply_time` DATETIME      NULL COMMENT '提交审核时间' AFTER `reject_reason`,
    ADD COLUMN `publish_time`      DATETIME       NULL COMMENT '正式发布上架时间' AFTER `publish_apply_time`,
    ADD COLUMN `reviewer_id`       INT            NULL COMMENT '审核人用户ID' AFTER `publish_time`,
    ADD COLUMN `review_time`       DATETIME       NULL COMMENT '审核操作时间' AFTER `reviewer_id`;
