[#2570] fixed default PRAGMAs not being applied for new connections

This commit is contained in:
Gani Georgiev
2023-05-27 09:04:01 +03:00
parent 833a84b3d7
commit f6a616b7e8
36 changed files with 99 additions and 73 deletions
-20
View File
@@ -1,20 +0,0 @@
package core
import (
"github.com/pocketbase/dbx"
)
func initPragmas(db *dbx.DB) error {
// note: the busy_timeout pragma must be first because
// the connection needs to be set to block on busy before WAL mode
// is set in case it hasn't been already set by another connection
_, err := db.NewQuery(`
PRAGMA busy_timeout = 10000;
PRAGMA journal_mode = WAL;
PRAGMA journal_size_limit = 200000000;
PRAGMA synchronous = NORMAL;
PRAGMA foreign_keys = ON;
`).Execute()
return err
}