fix: do not try to fetch nonexistant bucket
continuous-integration/drone/push Build is failing Details

This commit is contained in:
kolaente 2024-04-06 13:55:11 +02:00
parent ec1ff80791
commit 037022e857
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@
package migration
import (
"code.vikunja.io/api/pkg/log"
"src.techknowlogick.com/xormigrate"
"xorm.io/xorm"
)
@ -64,7 +65,12 @@ func init() {
}
for _, tb := range tbs {
tb.ProjectViewID = buckets[tb.BucketID].ProjectViewID
bucket, exists := buckets[tb.BucketID]
if !exists {
log.Debugf("Bucket %d does not exist but has task_buckets relation", tb.BucketID)
continue
}
tb.ProjectViewID = bucket.ProjectViewID
_, err = tx.
Where("task_id = ? AND bucket_id = ?", tb.TaskID, tb.BucketID).
Cols("project_view_id").