fix: migration

This commit is contained in:
naiba 2024-10-28 14:42:36 +08:00
parent 417f99d94f
commit 1e3c6b4a66
2 changed files with 4 additions and 12 deletions

View File

@ -1,8 +0,0 @@
package model
type ApiToken struct {
Common
UserID uint64 `json:"user_id"`
Token string `json:"token"`
Note string `json:"note"`
}

View File

@ -61,10 +61,10 @@ func InitDBFromPath(path string) {
if Conf.Debug {
DB = DB.Debug()
}
err = DB.AutoMigrate(model.Server{}, model.User{},
model.Notification{}, model.AlertRule{}, model.Service{},
model.ServiceHistory{}, model.Cron{}, model.Transfer{},
model.ApiToken{}, model.NAT{}, model.DDNSProfile{}, model.NotificationGroupNotification{})
err = DB.AutoMigrate(model.Server{}, model.User{}, model.ServerGroup{}, model.NotificationGroup{},
model.Notification{}, model.AlertRule{}, model.Service{}, model.NotificationGroupNotification{},
model.ServiceHistory{}, model.Cron{}, model.Transfer{}, model.ServerGroupServer{}, model.UserGroup{},
model.UserGroupUser{}, model.NAT{}, model.DDNSProfile{}, model.NotificationGroupNotification{})
if err != nil {
panic(err)
}