-- ============================================================
-- 小程序应用：按品牌开关套餐（两品牌共库，不能写 nl_system_config）
-- ============================================================

SET @db := DATABASE();
SET @exists := (
    SELECT COUNT(*) FROM information_schema.COLUMNS
    WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'nl_wx_app' AND COLUMN_NAME = 'package_enabled'
);
SET @sql := IF(@exists = 0,
    'ALTER TABLE `nl_wx_app` ADD COLUMN `package_enabled` tinyint NOT NULL DEFAULT 0 COMMENT ''1=启用套餐（首页热门+底栏）'' AFTER `template_code`',
    'SELECT ''skip nl_wx_app.package_enabled'' AS msg'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
