From 2dab2ccedde96b2363e69ed14d026922c8883705 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 15 Feb 2024 10:48:48 +0100 Subject: [PATCH] feat: allow using sqlite in memory database This allows running vikunja for testing purposes. You almost never want to run this in production. --- pkg/db/db.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/db/db.go b/pkg/db/db.go index dba8d7dc05..1570bdfc99 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -179,6 +179,10 @@ func initSqliteEngine() (engine *xorm.Engine, err error) { path = "./db.db" } + if path == "memory" { + return xorm.NewEngine("sqlite3", "file::memory:?cache=shared") + } + // Try opening the db file to return a better error message if that does not work var exists = true if _, err := os.Stat(path); err != nil {