From: Thomas Karpiniec Date: Sat, 19 Oct 2024 03:31:10 +0000 (+1100) Subject: Add suitable pragmas for sqlite X-Git-Tag: v1.0.0~14 X-Git-Url: https://code.octet-stream.net/broadcaster/commitdiff_plain/f316c6a23317701ae9fe2c097c55140dea655cfc?ds=inline;hp=d14180328760fa282068927068ca5675b9427bc2 Add suitable pragmas for sqlite --- diff --git a/.gitignore b/.gitignore index 97571d1..c2f7731 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ broadcaster-server broadcaster-radio test-server.conf test-radio.conf -test.db +test.db* diff --git a/server/database.go b/server/database.go index e6ce752..d6bbf92 100644 --- a/server/database.go +++ b/server/database.go @@ -21,10 +21,19 @@ func InitDatabase() { } db.sqldb = sqldb + _, err = db.sqldb.Exec("PRAGMA journal_mode = WAL") + if err != nil { + log.Fatal(err) + } + _, err = db.sqldb.Exec("PRAGMA foreign_keys = ON") if err != nil { - log.Printf("%q\n", err) - return + log.Fatal(err) + } + + _, err = db.sqldb.Exec("PRAGMA busy_timeout = 5000") + if err != nil { + log.Fatal(err) } sqlStmt := `