diff options
author | 2025-02-14 13:52:04 +0100 | |
---|---|---|
committer | 2025-02-14 12:52:04 +0000 | |
commit | 879ca2d2f8744a1071abfa06de437434a1f4797e (patch) | |
tree | 44d769f77850609f693e776894b877383244c5b8 /internal/db/bundb/migrations/util.go | |
parent | [chore] Bump elliptic from 6.6.0 to 6.6.1 in /web/source (#3791) (diff) | |
download | gotosocial-879ca2d2f8744a1071abfa06de437434a1f4797e.tar.xz |
[bugfix] Drop status indices AFTER updating visibility (#3795)
* [bugfix] Drop status indices AFTER updating visibility
* rename to status vis indices just to indicate they're only used in the statuses hook func
---------
Co-authored-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/db/bundb/migrations/util.go')
-rw-r--r-- | internal/db/bundb/migrations/util.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/db/bundb/migrations/util.go b/internal/db/bundb/migrations/util.go index bae5750df..7f8b57c42 100644 --- a/internal/db/bundb/migrations/util.go +++ b/internal/db/bundb/migrations/util.go @@ -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). |