Fix: image alias put query
Some checks failed
Go test / run-go-vet (push) Successful in 6s
Go test / check-swagger-up-to-date (push) Successful in 9s
Go test / run-go-test (push) Successful in 30s
Go test / cleanup-go-test (push) Successful in 4s
Go test / release-image (push) Has been cancelled

This commit is contained in:
2025-12-13 00:56:06 +08:00
parent 44a3bf64c1
commit 5e44171dcb
3 changed files with 61 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ package implements
import (
"context"
"fmt"
"gitea.konchin.com/go2025/backend/models"
"gitea.konchin.com/go2025/backend/tracing"
@@ -184,6 +185,14 @@ func (self *BunDatabase) UpdateAliases(
return err
}
err = tx.NewSelect().
Model(&aliases).
Where("name IN (?)", bun.In(aliasNames)).
Scan(ctx)
if err != nil {
return err
}
var rels []models.AliasImage
for _, alias := range aliases {
rels = append(rels, models.AliasImage{
@@ -191,6 +200,9 @@ func (self *BunDatabase) UpdateAliases(
ImageId: imageId,
})
}
tracing.Logger.Ctx(ctx).
Debug("wtf is happening",
zap.String("rels", fmt.Sprintf("%+v", rels)))
_, err = tx.NewInsert().
Model(&rels).
On(`CONFLICT ("alias_id", "image_id") DO NOTHING`).