Skip to content

Commit

Permalink
chore(gomall/tutorial): ch11 error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
LAPTOP-SHK1R85Q\wang committed Jun 5, 2024
1 parent f2d05af commit 039d838
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gomall/tutorial/ch11/app/cart/biz/dal/mysql/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ func Init() {
SkipDefaultTransaction: true,
},
)
DB.AutoMigrate(&model.Cart{})
if err != nil {
panic(err)
}

if os.Getenv("GO_ENV") != "online" {
err = DB.AutoMigrate(&model.Cart{})
if err != nil {
panic(err)
}
}
}

0 comments on commit 039d838

Please sign in to comment.