core/internal/bun/migrations/20240402044947_player_snapshots_new_index.go
Dawid Wysokiński 6bfb17f615
All checks were successful
ci/woodpecker/push/govulncheck Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/tag/deployment Pipeline was successful
feat: tribe_snapshots - add a new index
2024-04-02 07:10:03 +02:00

19 lines
476 B
Go

package migrations
import (
"context"
"github.com/uptrace/bun"
)
func init() {
migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
_, 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 {
_, err := db.ExecContext(ctx, "DROP INDEX IF EXISTS player_snapshots_server_key_date_idx;")
return err
})
}