diff --git a/pkg/models/kanban_task_bucket.go b/pkg/models/kanban_task_bucket.go index c8794201e..0b2b06eaf 100644 --- a/pkg/models/kanban_task_bucket.go +++ b/pkg/models/kanban_task_bucket.go @@ -152,6 +152,13 @@ func updateTaskBucket(s *xorm.Session, a web.Auth, b *TaskBucket) (err error) { if err != nil { return err } + // If the task is already in the default bucket, skip the + // upsert — MySQL's UPDATE returns 0 affected rows when + // the value is unchanged, which would make upsert fall + // through to INSERT and hit the unique constraint. + if b.BucketID == oldTaskBucket.BucketID { + updateBucket = false + } } }