Files
tyc-server-v2/deploy/sql/bank_card_withdrawal.sql
2026-01-22 16:04:12 +08:00

34 lines
1.5 KiB
SQL
Raw 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 表添加银行卡提现相关字段
-- 1. 添加提现类型字段1-支付宝2-银行卡)
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. 更新现有记录的 withdraw_type 为 1支付宝
UPDATE `agent_withdrawal` SET `withdraw_type` = 1 WHERE `withdraw_type` IS NULL OR `withdraw_type` = 0;
-- 说明:
-- 1. withdraw_type: 1=支付宝提现默认2=银行卡提现
-- 2. 现有支付宝提现记录的 withdraw_type 将自动设置为 1
-- 3. bank_card_no、bank_name、payee_name 字段允许为 NULL支付宝提现不需要这些字段
-- 4. 银行卡提现时payee_name 必须与实名认证的姓名一致