Fix sqlite db not working when creating a new one

This commit is contained in:
kolaente 2020-06-26 19:45:19 +02:00
parent be11362533
commit 974d028e51
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -173,6 +173,7 @@ func initSqliteEngine() (engine *xorm.Engine, err error) {
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.
_ = os.Remove(path) // Remove the file to not prevent the db from creating another one
return xorm.NewEngine("sqlite3", path)
}