core/internal/bun/migrations/20240402044947_player_snapshots_new_index.go

19 lines
476 B
Go
Raw Normal View History

package migrations
import (
"context"
"github.com/uptrace/bun"
)
func init() {
migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
2024-04-02 04:54:37 +00:00
_, err := db.ExecContext(ctx, "CREATE INDEX IF NOT EXISTS"+
" player_snapshots_server_key_date_idx ON player_snapshots(server_key, date);")
return err
}, func(ctx context.Context, db *bun.DB) error {
2024-04-02 04:54:37 +00:00
_, err := db.ExecContext(ctx, "DROP INDEX IF EXISTS player_snapshots_server_key_date_idx;")
return err
})
}