This commit is contained in:
parent
be9ad98f58
commit
9f0b0392c5
1 changed files with 4 additions and 4 deletions
8
main.go
8
main.go
|
@ -43,20 +43,20 @@ func migrateDB() {
|
|||
log.Info().Msg("Run Migration if exists")
|
||||
db, err := sql.Open("mysql", os.Getenv("DB_MIGRATION"))
|
||||
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{})
|
||||
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")
|
||||
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)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Fatal().Err(err).Msg("Cant create migrate instante")
|
||||
}
|
||||
err = m.Up()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue