29 lines
620 B
Go
29 lines
620 B
Go
package workerjobs
|
|
|
|
import (
|
|
"bitrix_balancer_api/system_service/types"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
type WorkerJobs struct {
|
|
ipc *types.InternalProviderControl
|
|
}
|
|
|
|
func WorkerJobsStart(ipc *types.InternalProviderControl) error {
|
|
jobs := &WorkerJobs{
|
|
ipc: ipc,
|
|
}
|
|
|
|
if ipc.Config.Environment == "" || ipc.Config.Environment == "dev" {
|
|
err := jobs.ipc.Database.Migrate().MigrateDB()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
logrus.Info("🟢🟢🟢 Database migration completed successfully")
|
|
} else {
|
|
logrus.Info("⚠️ production environment variable is set to prod mode. Skip migration")
|
|
}
|
|
|
|
return nil
|
|
}
|