From 9347d06de58ac34e146a2ca6bdbcbd12f2e1dfaa Mon Sep 17 00:00:00 2001 From: forgejo-backport-action Date: Tue, 27 Jan 2026 16:57:36 +0100 Subject: [PATCH] [v14.0/forgejo] feat: enable SQLite WAL by default (#11069) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/11059 - In order to avoid a database locked message, you either need shared cache or WAL. Shared cache was disabled in as its deprecrated and could cause more good than trouble. Enable WAL by default, it's only non-desirable in very narrow and select situations (NFS filesystem situation) and is otherwise safe as default. - Resolves forgejo/forgejo#10900 Docs: forgejo/docs!1717 ## Release notes - Features - [PR](https://codeberg.org/forgejo/forgejo/pulls/11069): feat: enable SQLite WAL by default Co-authored-by: Gusted Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11069 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: forgejo-backport-action Co-committed-by: forgejo-backport-action --- custom/conf/app.example.ini | 2 +- modules/setting/database.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index a432a142c3..f45b7731c5 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -362,7 +362,7 @@ RUN_USER = ; git DB_TYPE = sqlite3 ;PATH= ; defaults to data/forgejo.db ;SQLITE_TIMEOUT = ; Query timeout defaults to: 500 -;SQLITE_JOURNAL_MODE = ; defaults to sqlite database default (often DELETE), can be used to enable WAL mode. https://www.sqlite.org/pragma.html#pragma_journal_mode +;SQLITE_JOURNAL_MODE = WAL; defaults to sqlite database default (often DELETE), can be used to enable WAL mode. https://www.sqlite.org/pragma.html#pragma_journal_mode ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; diff --git a/modules/setting/database.go b/modules/setting/database.go index bd20edf9c2..a7940b48ca 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -87,7 +87,7 @@ func loadDBSetting(rootCfg ConfigProvider) { Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "forgejo.db")) Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500) - Database.SQLiteJournalMode = sec.Key("SQLITE_JOURNAL_MODE").MustString("") + Database.SQLiteJournalMode = sec.Key("SQLITE_JOURNAL_MODE").MustString("WAL") Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) if Database.Type.IsMySQL() {