mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-28 07:16:15 -06:00
rename to status vis indices just to indicate they're only used in the statuses hook func
This commit is contained in:
parent
3686279b89
commit
c9370a2da9
1 changed files with 6 additions and 7 deletions
|
|
@ -32,8 +32,8 @@ func init() {
|
||||||
up := func(ctx context.Context, db *bun.DB) error {
|
up := func(ctx context.Context, db *bun.DB) error {
|
||||||
return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error {
|
return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error {
|
||||||
|
|
||||||
// Visibility type indices.
|
// Status visibility type indices.
|
||||||
var visIndices = []struct {
|
var statusVisIndices = []struct {
|
||||||
name string
|
name string
|
||||||
cols []string
|
cols []string
|
||||||
order string
|
order string
|
||||||
|
|
@ -66,10 +66,9 @@ func init() {
|
||||||
Table: "statuses",
|
Table: "statuses",
|
||||||
Column: "visibility",
|
Column: "visibility",
|
||||||
IndexCleanupCallback: func(ctx context.Context, tx bun.Tx) error {
|
IndexCleanupCallback: func(ctx context.Context, tx bun.Tx) error {
|
||||||
// After new column has been
|
// After new column has been created and
|
||||||
// created and populated, drop
|
// populated, drop indices relying on old column.
|
||||||
// indices relying on old column.
|
for _, index := range statusVisIndices {
|
||||||
for _, index := range visIndices {
|
|
||||||
log.Infof(ctx, "dropping old index %s...", index.name)
|
log.Infof(ctx, "dropping old index %s...", index.name)
|
||||||
if _, err := tx.NewDropIndex().
|
if _, err := tx.NewDropIndex().
|
||||||
Index(index.name).
|
Index(index.name).
|
||||||
|
|
@ -107,7 +106,7 @@ func init() {
|
||||||
|
|
||||||
// Recreate the visibility indices.
|
// Recreate the visibility indices.
|
||||||
log.Info(ctx, "creating new visibility indexes...")
|
log.Info(ctx, "creating new visibility indexes...")
|
||||||
for _, index := range visIndices {
|
for _, index := range statusVisIndices {
|
||||||
log.Infof(ctx, "creating new index %s...", index.name)
|
log.Infof(ctx, "creating new index %s...", index.name)
|
||||||
q := tx.NewCreateIndex().
|
q := tx.NewCreateIndex().
|
||||||
Table("statuses").
|
Table("statuses").
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue