fix: do not try to fetch nonexistant bucket
This commit is contained in:
parent
ec1ff80791
commit
037022e857
@ -17,6 +17,7 @@
|
|||||||
package migration
|
package migration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"code.vikunja.io/api/pkg/log"
|
||||||
"src.techknowlogick.com/xormigrate"
|
"src.techknowlogick.com/xormigrate"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
)
|
)
|
||||||
@ -64,7 +65,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tb := range tbs {
|
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.
|
_, err = tx.
|
||||||
Where("task_id = ? AND bucket_id = ?", tb.TaskID, tb.BucketID).
|
Where("task_id = ? AND bucket_id = ?", tb.TaskID, tb.BucketID).
|
||||||
Cols("project_view_id").
|
Cols("project_view_id").
|
||||||
|
Loading…
x
Reference in New Issue
Block a user