added player names

This commit is contained in:
2026-02-19 20:48:31 +11:00
parent 970346f15d
commit 98b110ee44
5 changed files with 43 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
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 {
// Add your migration code here
_, err := conn.NewAddColumn().
Model((*db.Player)(nil)).
IfNotExists().
ColumnExpr("name VARCHAR NOT NULL").
Exec(ctx)
if err != nil {
return err
}
return nil
},
// DOWN migration
func(ctx context.Context, conn *bun.DB) error {
// Add your rollback code here
return nil
},
)
}