Ensure connection to database by pinging it once before creating the schema
@@ -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")
