-- 项目费用设置 JSON（管理费/税费/到款金额/自定义费用）

SET @c := (
    SELECT COUNT(1)
    FROM information_schema.COLUMNS
    WHERE TABLE_SCHEMA = DATABASE()
      AND TABLE_NAME = 'project'
      AND COLUMN_NAME = 'project_fee_json'
);
SET @sql := IF(@c = 0, 'ALTER TABLE project ADD COLUMN project_fee_json TEXT NULL AFTER expense_ratio_json', 'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;

ALTER TABLE project
    MODIFY COLUMN project_fee_json TEXT NULL COMMENT '项目费用设置（JSON）';
