Files
zyt/admin/PAYMENT_MIGRATION.md
T
2026-03-11 14:33:49 +08:00

44 lines
774 B
Markdown
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.
# 支付功能数据库迁移指南
## 需要执行的SQL
### 1. 添加 trade_no 字段到订单表
```sql
ALTER TABLE `la_order` ADD COLUMN `trade_no` varchar(100) DEFAULT NULL COMMENT '第三方交易号' AFTER `payment_time`;
```
### 2. 创建索引(可选,用于查询优化)
```sql
ALTER TABLE `la_order` ADD KEY `idx_trade_no` (`trade_no`);
```
## 执行步骤
1. 备份数据库
2. 在数据库管理工具中执行上述SQL
3. 验证字段是否添加成功
```sql
DESCRIBE `la_order`;
```
## 验证
执行以下查询验证迁移是否成功:
```sql
SELECT * FROM `la_order` LIMIT 1;
```
应该能看到新增的 `trade_no` 字段。
## 回滚
如果需要回滚,执行以下SQL
```sql
ALTER TABLE `la_order` DROP COLUMN `trade_no`;
```