Make the memory database actually in memory and not defer it so that it doesn't kill itself

This commit is contained in:
Tracker-Friendly 2024-07-21 08:59:16 +01:00
parent 9bd62dbf64
commit d4148a4939
1 changed files with 1 additions and 7 deletions

View File

@ -288,16 +288,10 @@ func main() {
}
}(conn)
mem, err = sql.Open("sqlite3", ":memory: cache=shared")
mem, err = sql.Open("sqlite3", ":memory:?cache=shared&mode=memory")
if err != nil {
log.Fatalln("[FATAL] Cannot open session database:", err)
}
defer func(mem *sql.DB) {
err := mem.Close()
if err != nil {
log.Println("[ERROR] Unknown in main() mem defer:", err)
}
}(mem)
_, err = mem.Exec("CREATE TABLE sessions (sessionid INTEGER PRIMARY KEY AUTOINCREMENT, session TEXT NOT NULL, id INTEGER NOT NULL, device TEXT NOT NULL DEFAULT '?')")
if err != nil {