Skip to content

Commit 3f9ffa4

Browse files
committed
fix
1 parent 68972a9 commit 3f9ffa4

File tree

7 files changed

+34
-5
lines changed

7 files changed

+34
-5
lines changed

assets/go-licenses.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ require (
8585
github.com/lib/pq v1.10.9
8686
github.com/markbates/goth v1.80.0
8787
github.com/mattn/go-isatty v0.0.20
88-
github.com/mattn/go-sqlite3 v1.14.24
8988
github.com/meilisearch/meilisearch-go v0.29.1-0.20241106140435-0bf60fad690a
9089
github.com/mholt/archiver/v3 v3.5.1
9190
github.com/microcosm-cc/bluemonday v1.0.27
9291
github.com/microsoft/go-mssqldb v1.7.2
9392
github.com/minio/minio-go/v7 v7.0.80
9493
github.com/msteinert/pam v1.2.0
94+
github.com/ncruces/go-sqlite3 v0.20.2
9595
github.com/nektos/act v0.2.63
9696
github.com/niklasfasching/go-org v1.7.0
9797
github.com/olivere/elastic/v7 v7.0.32
@@ -249,6 +249,7 @@ require (
249249
github.com/markbates/going v1.0.3 // indirect
250250
github.com/mattn/go-colorable v0.1.13 // indirect
251251
github.com/mattn/go-runewidth v0.0.16 // indirect
252+
github.com/mattn/go-sqlite3 v1.14.24 // indirect
252253
github.com/mholt/acmez/v2 v2.0.3 // indirect
253254
github.com/miekg/dns v1.1.62 // indirect
254255
github.com/minio/md5-simd v1.1.2 // indirect
@@ -260,6 +261,7 @@ require (
260261
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
261262
github.com/mschoch/smat v0.2.0 // indirect
262263
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
264+
github.com/ncruces/julianday v1.0.0 // indirect
263265
github.com/nwaples/rardecode v1.1.3 // indirect
264266
github.com/oklog/ulid v1.3.1 // indirect
265267
github.com/olekukonko/tablewriter v0.0.5 // indirect
@@ -289,6 +291,7 @@ require (
289291
github.com/spf13/viper v1.19.0 // indirect
290292
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
291293
github.com/subosito/gotenv v1.6.0 // indirect
294+
github.com/tetratelabs/wazero v1.8.1 // indirect
292295
github.com/toqueteos/webbrowser v1.2.0 // indirect
293296
github.com/unknwon/com v1.0.1 // indirect
294297
github.com/valyala/fastjson v1.6.4 // indirect

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,10 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
601601
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
602602
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
603603
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
604+
github.com/ncruces/go-sqlite3 v0.20.2 h1:cMLIwrLZQuCWVCEOowSqlIlpzgbag3jnYVW4NM5u01M=
605+
github.com/ncruces/go-sqlite3 v0.20.2/go.mod h1:yL4ZNWGsr1/8pcLfpPW1RT1WFdvyeHonrgIwwi4rvkg=
606+
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
607+
github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
604608
github.com/niklasfasching/go-org v1.7.0 h1:vyMdcMWWTe/XmANk19F4k8XGBYg0GQ/gJGMimOjGMek=
605609
github.com/niklasfasching/go-org v1.7.0/go.mod h1:WuVm4d45oePiE0eX25GqTDQIt/qPW1T9DGkRscqLW5o=
606610
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
@@ -751,6 +755,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
751755
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
752756
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
753757
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
758+
github.com/tetratelabs/wazero v1.8.1 h1:NrcgVbWfkWvVc4UtT4LRLDf91PsOzDzefMdwhLfA550=
759+
github.com/tetratelabs/wazero v1.8.1/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs=
754760
github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
755761
github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ=
756762
github.com/toqueteos/webbrowser v1.2.0/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM=

models/unittest/testdb.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"github.com/stretchr/testify/assert"
2727
"xorm.io/xorm"
2828
"xorm.io/xorm/names"
29+
30+
_ "github.com/ncruces/go-sqlite3/vfs/memdb" // for testing: sqlite3 vfs=memdb
2931
)
3032

3133
var giteaRoot string
@@ -170,7 +172,7 @@ type FixturesOptions struct {
170172

171173
// CreateTestEngine creates a memory database and loads the fixture data from fixturesDir
172174
func CreateTestEngine(opts FixturesOptions) error {
173-
x, err := xorm.NewEngine("sqlite3", "file::memory:?cache=shared&_txlock=immediate")
175+
x, err := xorm.NewEngine("sqlite3", "file:/data.db?vfs=memdb&_txlock=immediate")
174176
if err != nil {
175177
if strings.Contains(err.Error(), "unknown driver") {
176178
return fmt.Errorf(`sqlite3 requires: -tags sqlite,sqlite_unlock_notify%s%w`, "\n", err)

modules/setting/database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func DBConnStr() (string, error) {
126126
if Database.SQLiteJournalMode != "" {
127127
journalMode = "&_journal_mode=" + Database.SQLiteJournalMode
128128
}
129-
connStr = fmt.Sprintf("file:%s?cache=shared&mode=rwc&_busy_timeout=%d&_txlock=immediate%s",
129+
connStr = fmt.Sprintf("file:%s?mode=rwc&_busy_timeout=%d&_txlock=immediate%s",
130130
Database.Path, Database.Timeout, journalMode)
131131
default:
132132
return "", fmt.Errorf("unknown database type: %s", Database.Type)

modules/setting/database_sqlite.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
package setting
77

88
import (
9-
_ "github.com/mattn/go-sqlite3"
9+
_ "github.com/ncruces/go-sqlite3/driver"
10+
_ "github.com/ncruces/go-sqlite3/embed"
1011
)
1112

13+
// TODO: remove all "sqlite_unlock_notify" tag
14+
1215
func init() {
1316
EnableSQLite3 = true
1417
SupportedDatabaseTypes = append(SupportedDatabaseTypes, "sqlite3")

tests/integration/migration-test/migration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func restoreOldDB(t *testing.T, version string) {
126126
err := os.MkdirAll(path.Dir(setting.Database.Path), os.ModePerm)
127127
assert.NoError(t, err)
128128

129-
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?cache=shared&mode=rwc&_busy_timeout=%d&_txlock=immediate", setting.Database.Path, setting.Database.Timeout))
129+
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?mode=rwc&_busy_timeout=%d&_txlock=immediate", setting.Database.Path, setting.Database.Timeout))
130130
assert.NoError(t, err)
131131
defer db.Close()
132132

0 commit comments

Comments
 (0)