mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-27 16:06:15 -06:00
[bugfix] Drop status indices AFTER updating visibility
This commit is contained in:
parent
1ee56d66ce
commit
3686279b89
2 changed files with 47 additions and 24 deletions
|
|
@ -45,6 +45,7 @@ func convertEnums[OldType ~string, NewType ~int16](
|
|||
column string,
|
||||
mapping map[OldType]NewType,
|
||||
defaultValue *NewType,
|
||||
indexCleanupCallback func(context.Context, bun.Tx) error,
|
||||
) error {
|
||||
if len(mapping) == 0 {
|
||||
return errors.New("empty mapping")
|
||||
|
|
@ -110,6 +111,13 @@ func convertEnums[OldType ~string, NewType ~int16](
|
|||
log.Warnf(ctx, "total=%d does not match updated=%d", total, updated)
|
||||
}
|
||||
|
||||
// Run index cleanup callback if set.
|
||||
if indexCleanupCallback != nil {
|
||||
if err := indexCleanupCallback(ctx, tx); err != nil {
|
||||
return gtserror.Newf("error running index cleanup callback: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Drop the old column from table.
|
||||
if _, err := tx.NewDropColumn().
|
||||
Table(table).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue