fix: couldn't delete player snapshots - query timeout

This commit is contained in:
Dawid Wysokiński 2024-04-02 06:54:00 +02:00
parent 3f6466ef0c
commit 37b39c447f
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package migrations
import (
"context"
"github.com/uptrace/bun"
)
func init() {
migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
// CREATE INDEX CONCURRENTLY IF NOT EXISTS player_snapshots_server_key_date_idx ON player_snapshots(server_key, date);
_, err := db.ExecContext(ctx, "CREATE INDEX CONCURRENTLY 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 CONCURRENTLY IF EXISTS player_snapshots_server_key_date_idx;")
return err
})
}