# V5数据库迁移问题快速修复

**错误：** `#1060 - Duplicate column name 'provider_type'`

---

## 🚀 一键修复

### 方案1：修复现有数据（推荐）

```bash
# 1. 执行修复SQL
mysql -u root -p 1818ai << 'EOF'
-- 更新RunningHub模型的provider_type
UPDATE `points_config` 
SET `provider_type` = 'runninghub' 
WHERE `model_name` LIKE 'rh_sora2_%' 
  AND (`provider_type` = '' OR `provider_type` IS NULL);

-- 验证结果
SELECT model_name, provider_type, points_cost 
FROM `points_config` 
WHERE `model_name` LIKE 'rh_sora2_%';
EOF

# 2. 验证：应该看到12个模型，provider_type都是'runninghub'
```

---

### 方案2：使用修复脚本

```bash
# 执行修复脚本
mysql -u root -p 1818ai < FIX_V5_provider_type.sql

# 查看结果
mysql -u root -p 1818ai -e "SELECT model_name, provider_type FROM points_config WHERE model_name LIKE 'rh_sora2_%';"
```

---

## ✅ 验证修复成功

```sql
-- 所有12个模型的provider_type应该都是'runninghub'
SELECT 
    COUNT(*) as total_models,
    SUM(CASE WHEN provider_type = 'runninghub' THEN 1 ELSE 0 END) as correct_count
FROM `points_config`
WHERE `model_name` LIKE 'rh_sora2_%';

-- 预期结果：
-- total_models: 12
-- correct_count: 12
```

---

## 📋 如果还有问题

查看详细文档：`V5_MIGRATION_FIX_GUIDE.md`

---

**修复完成后，系统就可以正常使用RunningHub功能了！** ✅


