From 974d028e51bac66e91109246546fffe116a8be90 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 26 Jun 2020 19:45:19 +0200 Subject: [PATCH] Fix sqlite db not working when creating a new one --- pkg/db/db.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/db/db.go b/pkg/db/db.go index dd384e061..a3d6fffdf 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -172,7 +172,8 @@ func initSqliteEngine() (engine *xorm.Engine, err error) { if err != nil { return nil, fmt.Errorf("could not open database file [uid=%d, gid=%d]: %s", os.Getuid(), os.Getgid(), err) } - _ = file.Close() // We directly close the file because we only want to check if it is writable. It will be reopened lazily later by xorm. + _ = file.Close() // We directly close the file because we only want to check if it is writable. It will be reopened lazily later by xorm. + _ = os.Remove(path) // Remove the file to not prevent the db from creating another one return xorm.NewEngine("sqlite3", path) }