summaryrefslogtreecommitdiff
path: root/internal/db/bundb/media.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-06-26 14:17:47 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-06-26 14:17:47 +0200
commit39b11dbfb6f18c85ebe157ea9f85c7378c2cfb59 (patch)
tree7a071466d01bb0543dc7b57d1795f3db789056b2 /internal/db/bundb/media.go
parent[bugfix] move broken stage of filters migration into new migration (#4293) (diff)
downloadgotosocial-39b11dbfb6f18c85ebe157ea9f85c7378c2cfb59.tar.xz
[bugfix] fix issues with postgres array serialization (#4295)
thank you to @kipvandenbos -erino for figuring this out! Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4295 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/db/bundb/media.go')
-rw-r--r--internal/db/bundb/media.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/db/bundb/media.go b/internal/db/bundb/media.go
index 845844980..86f63ace2 100644
--- a/internal/db/bundb/media.go
+++ b/internal/db/bundb/media.go
@@ -196,13 +196,17 @@ func (m *mediaDB) DeleteAttachment(ctx context.Context, id string) error {
})
if len(updatedIDs) != len(status.AttachmentIDs) {
+
+ // Convert to bun array for serialization.
+ arrIDs := bunArrayType(tx, updatedIDs)
+
// Note: this handles not found.
//
// Attachments changed, update the status.
if _, err := tx.NewUpdate().
Table("statuses").
Where("? = ?", bun.Ident("id"), status.ID).
- Set("? = ?", bun.Ident("attachment_ids"), updatedIDs).
+ Set("? = ?", bun.Ident("attachment_ids"), arrIDs).
Exec(ctx); err != nil {
return gtserror.Newf("error updating status: %w", err)
}