Skip to content

Commit

Permalink
Error catching for db migration
Browse files Browse the repository at this point in the history
  • Loading branch information
BreathXV committed Jun 5, 2024
1 parent ffebef7 commit cfcfaef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ func main() {
log.Fatal(err)
}

db.AutoMigrate(&client{})
if err := db.AutoMigrate(&client{}); err != nil {
log.Fatal("Failed to migrate database", err)
}

log.Println("Connected to database successfully.")

Expand Down

0 comments on commit cfcfaef

Please sign in to comment.