Extend model with sections & model

This commit is contained in:
William Bouzourène 2024-12-24 12:14:53 +01:00
parent 0351eeafd4
commit 4be15c2f12
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww
4 changed files with 77 additions and 1 deletions

View file

@ -30,8 +30,23 @@ func connectDatabase() (*gorm.DB, error) {
sqlite.Open(config.Database.Location),
&gorm.Config{},
)
if err != nil {
// TODO: Handle exception
log.Fatal(err)
}
database.AutoMigrate(&models.User{})
err = database.AutoMigrate(
&models.User{},
&models.ParentSection{},
&models.Section{},
&models.Person{},
&models.ManageSection{},
&models.ManageParentSection{},
)
if err != nil {
// TODO: Handle exception
log.Fatal(err)
}
connected = true