Files
oslstats/internal/db/migrations/20260127194815_seasons.go
2026-02-14 19:48:59 +11:00

35 lines
586 B
Go

package migrations
import (
"context"
"git.haelnorr.com/h/oslstats/internal/db"
"github.com/uptrace/bun"
)
func init() {
Migrations.MustRegister(
// UP migration
func(ctx context.Context, conn *bun.DB) error {
_, err := conn.NewCreateTable().
Model((*db.Season)(nil)).
Exec(ctx)
if err != nil {
return err
}
return nil
},
// DOWN migration
func(ctx context.Context, conn *bun.DB) error {
_, err := conn.NewDropTable().
Model((*db.Season)(nil)).
IfExists().
Exec(ctx)
if err != nil {
return err
}
return nil
},
)
}