[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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user