SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;

-- 运行快照表是小型政策表；空值保持历史政策“每天可提现”，无需扫描或改写提现、交易和计数流水。
SET @ddl := IF(
  (SELECT COUNT(*) FROM information_schema.COLUMNS
   WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'host_agency_salary_policies'
     AND COLUMN_NAME = 'platform_withdrawal_allowed_days') = 0,
  'ALTER TABLE 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;
