mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-22 06:31:15 +01:00
Ensure connection to database by pinging it once before creating the schema
This commit is contained in:
parent
cbfdc359d3
commit
d69df41ef0
@ -63,6 +63,9 @@ func NewStore(driver, path string) (*Store, error) {
|
||||
if store.db, err = sql.Open(driver, path); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := store.db.Ping(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if driver == "sqlite" {
|
||||
_, _ = store.db.Exec("PRAGMA foreign_keys=ON")
|
||||
_, _ = store.db.Exec("PRAGMA journal_mode=WAL")
|
||||
|
Loading…
Reference in New Issue
Block a user