优化结构

This commit is contained in:
Yvan
2026-08-22 21:39:39 +08:00
parent 699bcceeea
commit 0126995090
17 changed files with 61 additions and 52 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ func Migrations() []migration.Step {
return []migration.Step{{
ID: "202608220001_task_schema",
Migrate: func(db *gorm.DB) error {
return migration.CreateMissingTables(db, &TaskPO{}, &TaskLogPO{})
return migration.CreateMissingTables(db, &taskPO{}, &taskLogPO{})
},
}}
}
@@ -36,7 +36,7 @@ func SeedDefaults(ctx context.Context, db *gorm.DB, defaults []platformmodule.Ti
if strings.TrimSpace(item.Name) == "" {
continue
}
row := TaskPO{Name: item.Name, Description: item.Description, Spec: item.Spec, WithSeconds: item.WithSeconds, ExecutorType: "method", MethodName: item.MethodName, Enabled: item.Enabled}
row := taskPO{Name: item.Name, Description: item.Description, Spec: item.Spec, WithSeconds: item.WithSeconds, ExecutorType: "method", MethodName: item.MethodName, Enabled: item.Enabled}
if err := tx.Where("name = ?", row.Name).FirstOrCreate(&row).Error; err != nil {
return err
}