初步创建计划相关model

This commit is contained in:
2025-09-12 21:06:19 +08:00
parent 52669e7055
commit 6797db914a
2 changed files with 93 additions and 1 deletions

View File

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