Files
jurong_circle_black/migrations/add_alipay_support.sql

17 lines
1.1 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.

-- 为支付订单表添加支付宝支持
-- 更新交易类型枚举,添加支付宝相关类型
ALTER TABLE `payment_orders` MODIFY COLUMN `trade_type` varchar(32) NOT NULL COMMENT '交易类型(H5/JSAPI/ALIPAY_WAP/ALIPAY_APP等)';
-- 更新transaction_id字段注释支持多种支付方式
ALTER TABLE `payment_orders` MODIFY COLUMN `transaction_id` varchar(64) DEFAULT NULL COMMENT '第三方支付订单号(微信/支付宝)';
-- 添加支付方式字段
ALTER TABLE `payment_orders` ADD COLUMN `payment_method` enum('wechat','alipay') DEFAULT 'wechat' COMMENT '支付方式' AFTER `trade_type`;
-- 添加支付宝特有字段
ALTER TABLE `payment_orders` ADD COLUMN `buyer_user_id` varchar(32) DEFAULT NULL COMMENT '支付宝买家用户ID' AFTER `transaction_id`;
ALTER TABLE `payment_orders` ADD COLUMN `trade_status` varchar(32) DEFAULT NULL COMMENT '支付宝交易状态' AFTER `buyer_user_id`;
-- 添加索引
ALTER TABLE `payment_orders` ADD KEY `idx_payment_method` (`payment_method`);
ALTER TABLE `payment_orders` ADD KEY `idx_trade_status` (`trade_status`);