[bugfix] Only insert status pins if slice not empty (#4743)

Fix a little migration oopsie.

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4743
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
tobi
2026-03-10 15:07:24 +01:00
committed by tobi
parent 7362d55a35
commit 085448e30d
@@ -183,10 +183,12 @@ func init() {
}
// Insert new pinned models.
if _, err := tx.NewInsert().
Model(&statusPins).
Exec(ctx); err != nil {
return gtserror.Newf("error inserting status pins: %w", err)
if len(statusPins) != 0 {
if _, err := tx.NewInsert().
Model(&statusPins).
Exec(ctx); err != nil {
return gtserror.Newf("error inserting status pins: %w", err)
}
}
// Increment updated total by ID count.