fix(assets): correct type column in assets (#4295)

* fix(asssets): correct remove asset objects with text column

* fix(assets): type asset_type, correct and add unit tests

* fix(assets): set unspecified objecttype to empty string

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Stefan Benz
2022-09-08 08:39:38 +01:00
committed by GitHub
parent aa4df33b62
commit 5052aa1c12
3 changed files with 127 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ func (c *crdbStorage) PutObject(ctx context.Context, instanceID, location, resou
}
stmt, args, err := squirrel.Insert(assetsTable).
Columns(AssetColInstanceID, AssetColResourceOwner, AssetColName, AssetColType, AssetColContentType, AssetColData, AssetColUpdatedAt).
Values(instanceID, resourceOwner, name, objectType, contentType, data, "now()").
Values(instanceID, resourceOwner, name, objectType.String(), contentType, data, "now()").
Suffix(fmt.Sprintf(
"ON CONFLICT (%s, %s, %s) DO UPDATE"+
" SET %s = $5, %s = $6"+
@@ -167,7 +167,7 @@ func (c *crdbStorage) RemoveObjects(ctx context.Context, instanceID, resourceOwn
Where(squirrel.Eq{
AssetColInstanceID: instanceID,
AssetColResourceOwner: resourceOwner,
AssetColType: objectType,
AssetColType: objectType.String(),
}).
PlaceholderFormat(squirrel.Dollar).
ToSql()