fixed incorrect if breaking test db
This commit is contained in:
parent
dfdbf2b63e
commit
dc0b37e564
1 changed files with 9 additions and 9 deletions
|
@ -26,17 +26,17 @@ func Init_testdb(DB_TYPE string, DB_CONNECTION_STRING string) {
|
||||||
log.Trace().Msgf("Currect working directory is: %s", cwd)
|
log.Trace().Msgf("Currect working directory is: %s", cwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = os.Stat(cwd + DB_CONNECTION_STRING)
|
_, err = os.Stat(cwd + DB_CONNECTION_STRING)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug().Msg("Found existing test.db file. Attempting to delete")
|
|
||||||
err = os.Remove(DB_CONNECTION_STRING)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn().Err(err).Msg("Failed to delete testing db. Continueing anyways")
|
|
||||||
} else {
|
|
||||||
log.Debug().Msg("Deleted test.db file successfully")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Debug().Msg("No existing test.db file found")
|
log.Debug().Msg("No existing test.db file found")
|
||||||
|
} else {
|
||||||
|
log.Debug().Msg("Found existing test.db file. Attempting to delete")
|
||||||
|
err = os.Remove(cwd + DB_CONNECTION_STRING)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Err(err).Msg("Failed to delete testing db. Continueing anyways")
|
||||||
|
} else {
|
||||||
|
log.Debug().Msg("Deleted test.db file successfully")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err := sqlx.Connect(DB_TYPE, DB_CONNECTION_STRING)
|
db, err := sqlx.Connect(DB_TYPE, DB_CONNECTION_STRING)
|
||||||
|
|
Loading…
Reference in a new issue