优化结构
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user