refactor(db): 阶段A - driver 抽象 + SQLite 保持工作
- db.Open 改为接受 URL(sqlite:// mysql:// postgres://),返回 (db, dialect, err) - 向后兼容:不含 scheme 的路径仍按 SQLite 文件处理 - migration 移到 migrations/sqlite/ 子目录,embed 包含三个方言目录 - Migrate 按方言选择子目录 + goose dialect - Store 加 Dialect 字段,NewStore(db, dialect) - cmd/server 加 -db-url 和 DATABASE_URL 环境变量(优先级:env > -db-url > -db) - cmd/init-admin 同步支持 URL - 新增依赖 pgx/v5、go-sql-driver/mysql - mysql/postgres migration 目录暂为 SQLite 副本占位,阶段B/C 替换 - 所有测试调用方更新为新签名 验证:现有测试全过(SQLite 回归),SQLite 行为不变 Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
3f7954af84
commit
0fa5d6617c
39 files changed
+1459
-49
No files matched your search
@@ -5,6 +5,8 @@ go 1.26.4
|
||||
require (
|
||||
github.com/coder/websocket v1.8.15
|
||||
github.com/go-chi/chi/v5 v5.3.0
|
||||
github.com/go-sql-driver/mysql v1.10.0
|
||||
github.com/jackc/pgx/v5 v5.10.0
|
||||
github.com/playwright-community/playwright-go v0.5700.1
|
||||
github.com/pressly/goose/v3 v3.27.1
|
||||
github.com/sashabaranov/go-openai v1.41.2
|
||||
@@ -15,11 +17,15 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.2.0 // indirect
|
||||
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
|
||||
github.com/go-stack/stack v1.8.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
github.com/mattn/go-isatty v0.0.21 // indirect
|
||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||
@@ -28,6 +34,7 @@ require (
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/sync v0.20.0 // indirect
|
||||
golang.org/x/sys v0.46.0 // indirect
|
||||
golang.org/x/text v0.36.0 // indirect
|
||||
modernc.org/libc v1.73.4 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
|
||||
Reference in new issue
Block a user