refactor: remove standalone migrate command, auto-migrate on startup

Migrations already run idempotently during RunServer startup via goose
(which tracks applied versions in goose_db_version). The separate
 command is redundant — removed it and consolidated
serveCmd/configFile/init into server.go.
This commit is contained in:
2026-07-27 14:43:22 +08:00
parent 90e53aa754
commit 264b84a738
4 changed files with 44 additions and 79 deletions
+2 -2
View File
@@ -42,7 +42,7 @@
| 30 | importStorage 导入顺序 | settings→sources→templates→collections | `handler/storage.go` |
| 31 | exportStorage 排除内置模板 | 过滤 BuiltinTemplateIDs | `handler/storage.go` |
| 32 | source_cache TTL 清理 | 后台 goroutine 定时清理 | `database/cache_repo.go` |
| 33 | goose 迁移嵌入 | //go:embed + SetBaseFS | `cmd/migrate.go` |
| 33 | goose 迁移嵌入 | //go:embed + SetBaseFS | `database/migrations.go` |
| 34 | goroutine 关闭安全 | sync.WaitGroup + context | `service/subscription.go` |
| 35 | 缓存操作错误吞咽 | recover + 日志,不传播 | `database/cache_repo.go` |
| 36 | 并发 wait 延迟 | 保留 waitMs 参数 | `service/concurrency.go` |
@@ -491,7 +491,7 @@ func RunMigrations(db *sqlx.DB) error {
}
```
**落地**`cmd/migrate.go` + `database/migrations/*.sql`。
**落地**`database/migrations.go` + `database/migrations/*.sql`。启动时自动执行,幂等(goose 跟踪 `goose_db_version`)。
---