feat: tribe_snapshots - add a new index
This commit is contained in:
parent
a0c109a04d
commit
6bfb17f615
|
@ -8,7 +8,6 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
|
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 IF NOT EXISTS"+
|
_, err := db.ExecContext(ctx, "CREATE INDEX IF NOT EXISTS"+
|
||||||
" player_snapshots_server_key_date_idx ON player_snapshots(server_key, date);")
|
" player_snapshots_server_key_date_idx ON player_snapshots(server_key, date);")
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
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"+
|
||||||
|
" tribe_snapshots_server_key_date_idx ON tribe_snapshots(server_key, date);")
|
||||||
|
return err
|
||||||
|
}, func(ctx context.Context, db *bun.DB) error {
|
||||||
|
_, err := db.ExecContext(ctx, "DROP INDEX IF EXISTS tribe_snapshots_server_key_date_idx;")
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue