make sure we migrate the database models.

This commit is contained in:
Jason Kulatunga 2023-11-20 09:23:00 -08:00
parent dbd868c796
commit a161f41998
No known key found for this signature in database
1 changed files with 7 additions and 1 deletions

View File

@ -40,9 +40,15 @@ func (gr *GormRepository) Migrate() error {
}) })
if err := m.Migrate(); err != nil { if err := m.Migrate(); err != nil {
gr.Logger.Errorf("Database migration failed with error. \n Please open a github issue at https://github.com/fastenhealth/fasten-onprem and attach a copy of your fasten.db file. \n %v", err) gr.Logger.Errorf("Database migration failed with error. \n Please open a github issue at https://github.com/fastenhealth/fasten-onprem. \n %v", err)
return err return err
} }
//TODO: final migration step. This should not be necessary once we do true migrations for the databaseModels.
if err := databaseModel.Migrate(gr.GormClient); err != nil {
gr.Logger.Errorf("Final Database migration failed with error.\n Please open a github issue at https://github.com/fastenhealth/fasten-onprem. \n %v", err)
}
gr.Logger.Infoln("Database migration completed successfully") gr.Logger.Infoln("Database migration completed successfully")
return nil return nil
} }