chore: update db utils (#2177)

This commit is contained in:
boojack
2023-08-26 07:33:45 +08:00
committed by GitHub
parent 4af0d03e93
commit ad1822d308
10 changed files with 1016 additions and 6 deletions

View File

@ -42,11 +42,16 @@ var (
Run: func(_cmd *cobra.Command, _args []string) {
ctx, cancel := context.WithCancel(context.Background())
db := db.NewDB(profile)
if err := db.Open(ctx); err != nil {
if err := db.Open(); err != nil {
cancel()
log.Error("failed to open db", zap.Error(err))
return
}
if err := db.Migrate(ctx); err != nil {
cancel()
log.Error("failed to migrate db", zap.Error(err))
return
}
store := store.New(db.DBInstance, profile)
s, err := server.NewServer(ctx, profile, store)