Skip to content

Commit

Permalink
fix(db.go): added error checking for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOduneye committed Oct 7, 2023
1 parent 6a3843f commit 1aff58f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/src/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func InitDB() (*gorm.DB, error) {
}
}

db.AutoMigrate(
if err := db.AutoMigrate(
&model.File{},
&model.Persona{},
&model.PersonaTaskJunction{},
Expand All @@ -61,7 +61,9 @@ func InitDB() (*gorm.DB, error) {
&model.Task{},
&model.UserProfile{},
&model.User{},
)
); err != nil {
return nil, fmt.Errorf("failed to perform database auto migration: %v", err)
}

return db, nil
}

0 comments on commit 1aff58f

Please sign in to comment.