diff --git a/cmd/main.go b/cmd/main.go index 6abb231..1d2553b 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -3,6 +3,7 @@ package main import ( "bikefest/docs" "bikefest/pkg/bootstrap" + "bikefest/pkg/model" "bikefest/pkg/router" "bikefest/pkg/service" "fmt" @@ -50,6 +51,16 @@ func main() { // init config app := bootstrap.App() + // TODO: needs to consider whether migrate the db schema everytime the service boot + err := app.Conn.AutoMigrate( + &model.User{}, + &model.Event{}, + &model.PsychoTest{}, + ) + if err != nil { + panic(err) + } + // init services userService := service.NewUserService(app.Conn, app.Cache) eventService := service.NewEventService(app.Conn, app.Cache)