Log for migration
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kekskurse 2022-01-15 00:44:48 +01:00
parent be9ad98f58
commit 9f0b0392c5
Signed by: kekskurse
GPG key ID: 728ACCB59341E7E4

View file

@ -43,20 +43,20 @@ func migrateDB() {
log.Info().Msg("Run Migration if exists") log.Info().Msg("Run Migration if exists")
db, err := sql.Open("mysql", os.Getenv("DB_MIGRATION")) db, err := sql.Open("mysql", os.Getenv("DB_MIGRATION"))
if err != nil { if err != nil {
panic(err) log.Fatal().Err(err).Str("Connection String", os.Getenv("DB_MIGRATION")).Msg("Cant Open SQL Connection")
} }
driver, err := mysql.WithInstance(db, &mysql.Config{}) driver, err := mysql.WithInstance(db, &mysql.Config{})
if err != nil { if err != nil {
panic(err) log.Fatal().Err(err).Str("Connection String", os.Getenv("DB_MIGRATION")).Msg("Cant create drive")
} }
d, err := iofs.New(database, "database/migrations") d, err := iofs.New(database, "database/migrations")
if err != nil { if err != nil {
panic(err) log.Fatal().Err(err).Msg("Cant creat iofs to get migrations from")
} }
m, err := migrate.NewWithInstance("iofs", d, "mysql", driver) m, err := migrate.NewWithInstance("iofs", d, "mysql", driver)
if err != nil { if err != nil {
panic(err) log.Fatal().Err(err).Msg("Cant create migrate instante")
} }
err = m.Up() err = m.Up()
if err != nil { if err != nil {