SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;

-- 工资政策是按 App/月份维护的小型配置表；日期使用最长 1,2,...,31 的规范逗号串，空串兼容为每天可提现。
SET @ddl := IF(
  (SELECT COUNT(*) FROM information_schema.COLUMNS
   WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'admin_host_agency_salary_policies'
     AND COLUMN_NAME = 'platform_withdrawal_allowed_days') = 0,
  'ALTER TABLE admin_host_agency_salary_policies ADD COLUMN platform_withdrawal_allowed_days VARCHAR(96) NOT NULL DEFAULT '''' COMMENT ''用户找平台提现允许的 UTC 月内日，逗号分隔，空表示每天'' AFTER platform_withdrawal_limit_count, ALGORITHM=INPLACE, LOCK=NONE',
  'SELECT 1'
);
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
