Files
hm-server/deploy/sql/agent_withdrawal_fix_columns.sql
2026-02-11 17:53:50 +08:00

25 lines
1.3 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ============================================================
-- agent_withdrawal 表缺失字段修复脚本
-- 解决 Error 1054: Unknown column 'withdraw_type'/'bank_card_no'/'bank_name'/'payee_name' in 'field list'
-- 执行方式:在 MySQL 客户端或 Navicat 等工具中逐条执行
-- 若某字段已存在会报 Duplicate column name跳过该条继续执行下一条即可
-- ============================================================
-- 1. 添加提现类型
ALTER TABLE `agent_withdrawal` ADD COLUMN `withdraw_type` TINYINT NOT NULL DEFAULT 1 COMMENT '提现类型:1-支付宝,2-银行卡' AFTER `agent_id`;
-- 2. 添加银行卡号
ALTER TABLE `agent_withdrawal` ADD COLUMN `bank_card_no` VARCHAR(50) DEFAULT NULL COMMENT '银行卡号' AFTER `payeeAccount`;
-- 3. 添加开户支行
ALTER TABLE `agent_withdrawal` ADD COLUMN `bank_name` VARCHAR(100) DEFAULT NULL COMMENT '开户支行' AFTER `bank_card_no`;
-- 4. 添加收款人姓名
ALTER TABLE `agent_withdrawal` ADD COLUMN `payee_name` VARCHAR(50) DEFAULT NULL COMMENT '收款人姓名' AFTER `bank_name`;
-- 5. 添加索引(若已存在可跳过)
ALTER TABLE `agent_withdrawal` ADD INDEX `idx_withdraw_type` (`withdraw_type`);
-- 6. 更新现有记录
UPDATE `agent_withdrawal` SET `withdraw_type` = 1 WHERE `withdraw_type` IS NULL OR `withdraw_type` = 0;