Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: enqueue task for rollback sql generation if it's done (#4661)

p0ny4526a27f6411
diff --git a/backend/runner/taskrun/scheduler.go b/backend/runner/taskrun/scheduler.go
index 0e9be9a897..437b35a7c3 100644
--- a/backend/runner/taskrun/scheduler.go
+++ b/backend/runner/taskrun/scheduler.go
@@ -372,8 +372,8 @@ func (s *Scheduler) PatchTask(ctx context.Context, task *store.TaskMessage, task
}
if taskPatch.RollbackEnabled != nil {
- // Enqueue the task
- if *taskPatch.RollbackEnabled {
+ // Enqueue the task if it's done.
+ if *taskPatch.RollbackEnabled && taskPatched.Status == api.TaskDone {
s.stateCfg.RollbackGenerate.Store(taskPatched.ID, taskPatched)
} else {
// Cancel running rollback sql generation.