feat: Added migration tool
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.ostiwe.com/ostiwe-com/status/model"
|
||||
"git.ostiwe.com/ostiwe-com/status/modules/db"
|
||||
appLog "git.ostiwe.com/ostiwe-com/status/modules/log"
|
||||
"git.ostiwe.com/ostiwe-com/status/modules/queue"
|
||||
@@ -21,11 +20,6 @@ func Run(serverArgs *args.ServerCmd) {
|
||||
}
|
||||
|
||||
db.SetGlobal(connect)
|
||||
appLog.Global.Get(appLog.SYSTEM).Info("Run db migration")
|
||||
if err = runMigrate(); err != nil {
|
||||
appLog.Global.Get(appLog.SYSTEM).Error(fmt.Sprintf("Migration failed, error: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
appLog.Global.Get(appLog.SYSTEM).Info("Start service observer")
|
||||
go queue.InitQueues()
|
||||
@@ -38,10 +32,3 @@ func Run(serverArgs *args.ServerCmd) {
|
||||
appLog.Global.Get(appLog.SERVER).Error(fmt.Sprintf("Startup server error: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
func runMigrate() error {
|
||||
return db.Global.AutoMigrate(
|
||||
model.Service{},
|
||||
model.Status{},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user