fix: 补上漏掉的 schema 版本号,修好渠道添加模型失败

c39c3e7 给 Model 加了 cache_write_price/context_length/supports_* 等列
但没递增 schemaVersion,user_version>=2 的库直接跳过 AutoMigrate,
models 表缺新列导致 Create 失败、渠道管理添加模型报缺列错误。
bump 到 3 触发一次迁移补齐列。
This commit is contained in:
Sakurasan committed 2026-10-28 15:40:03 +08:00
1 parent 75c8ecd519
commit 7c597a6aa0
1 file changed
+5 -1
+5 -1
View File
@@ -16,7 +16,11 @@ import (
// 触发一次 AutoMigrate 并把新版本写入库(SQLite 用 PRAGMA user_version)。
// AutoMigrate 对已有表的列判定不收敛(每次都重建表:CREATE __temp + INSERT SELECT + DROP),
// 大表上一次重建数十秒且每次重启重演,所以之后版本未变就直接跳过。
const schemaVersion = 2
//
// 注意:c39c3e7 给 Model 加了 cache_write_price/context_length/supports_tools/
// supports_vision/supports_reasoning 等列并删掉了 display_name,但当时漏改这里,
// 导致已建库的实例永远跳过重迁移、新增模型时 Create 因缺列而失败。这里补到 3 触发一次迁移。
const schemaVersion = 3
// Open 打开数据库连接并自动迁移。
// 开发默认 SQLite(dsn 支持 file:...?_journal_mode=WAL),生产可切 postgres。