mirror of
https://github.com/amigan/aim-oscar-server.git
synced 2025-01-31 21:12:38 -05:00
20 lines
493 B
Go
20 lines
493 B
Go
|
package migrations
|
||
|
|
||
|
import (
|
||
|
"aim-oscar/models"
|
||
|
"context"
|
||
|
"os"
|
||
|
|
||
|
"github.com/uptrace/bun"
|
||
|
"github.com/uptrace/bun/dbfixture"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
Migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
|
||
|
db.RegisterModel((*models.User)(nil), (*models.Message)(nil), (*models.Buddy)(nil), (*models.EmailVerification)(nil))
|
||
|
|
||
|
fixture := dbfixture.New(db, dbfixture.WithRecreateTables())
|
||
|
return fixture.Load(context.Background(), os.DirFS("./"), "init_fixtures.yml")
|
||
|
}, nil)
|
||
|
}
|