core/internal/bun/migrations/20240402050651_tribe_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
473 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"+
" 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
})
}