增加获取表列表方法

This commit is contained in:
2025-09-13 15:14:08 +08:00
parent fcea68c7c7
commit d169f9b9d1
3 changed files with 15 additions and 10 deletions

View File

@@ -124,15 +124,7 @@ func initStorage(cfg config.DatabaseConfig, logger *logs.Logger) (database.Stora
}
// 执行数据库迁移
// 这里需要添加所有需要自动迁移的模型
var dbModels = []interface{}{
&models.User{},
&models.Device{},
&models.Plan{},
&models.SubPlan{},
&models.Task{},
}
if err := storage.Migrate(dbModels...); err != nil {
if err := storage.Migrate(models.GetAllModels()...); err != nil {
return nil, fmt.Errorf("数据库迁移失败: %w", err)
}