Manager: on deletion of a worker, do not cascade to deletion of its tasks

Fix an issue where deleting a Worker would also delete the tasks it was
assigned to.
This commit is contained in:
Sybren A. Stüvel 2022-07-15 16:39:51 +02:00
parent b511fad968
commit 859a261b05

View File

@ -48,7 +48,7 @@ type Task struct {
// Which worker is/was working on this. // Which worker is/was working on this.
WorkerID *uint WorkerID *uint
Worker *Worker `gorm:"foreignkey:WorkerID;references:ID;constraint:OnDelete:CASCADE"` Worker *Worker `gorm:"foreignkey:WorkerID;references:ID;constraint:OnDelete:SET NULL"`
LastTouchedAt time.Time `gorm:"index"` // Should contain UTC timestamps. LastTouchedAt time.Time `gorm:"index"` // Should contain UTC timestamps.
// Dependencies are tasks that need to be completed before this one can run. // Dependencies are tasks that need to be completed before this one can run.