Use WAL mode
This commit is contained in:
parent
aca2e8778c
commit
f1cb72ccc8
|
|
@ -2,4 +2,6 @@
|
||||||
basic-sensor-receiver.exe
|
basic-sensor-receiver.exe
|
||||||
basic-sensor-receiver
|
basic-sensor-receiver
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
|
*.sqlite3-shm
|
||||||
|
*.sqlite3-wal
|
||||||
tmp/
|
tmp/
|
||||||
|
|
@ -13,6 +13,12 @@ func Initialize(databaseUrl string) (*sql.DB, error) {
|
||||||
return nil, fmt.Errorf("failed to open database connection: %w", err)
|
return nil, fmt.Errorf("failed to open database connection: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = db.Exec(`PRAGMA journal_mode=WAL;`)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to set journal mode: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE TABLE IF NOT EXISTS migrations (
|
_, err = db.Exec(`CREATE TABLE IF NOT EXISTS migrations (
|
||||||
id TEXT NOT NULL,
|
id TEXT NOT NULL,
|
||||||
run_at INTEGER NOT NULL
|
run_at INTEGER NOT NULL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue