Skip to content

Commit 341b9b8

Browse files
committed
fix
1 parent fa175c1 commit 341b9b8

File tree

10 files changed

+22
-10
lines changed

10 files changed

+22
-10
lines changed

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ require (
8787
github.com/lib/pq v1.10.9
8888
github.com/markbates/goth v1.80.0
8989
github.com/mattn/go-isatty v0.0.20
90-
github.com/mattn/go-sqlite3 v1.14.24
9190
github.com/meilisearch/meilisearch-go v0.29.1-0.20241106140435-0bf60fad690a
9291
github.com/mholt/archiver/v3 v3.5.1
9392
github.com/microcosm-cc/bluemonday v1.0.27
9493
github.com/microsoft/go-mssqldb v1.7.2
9594
github.com/minio/minio-go/v7 v7.0.80
9695
github.com/msteinert/pam v1.2.0
96+
github.com/ncruces/go-sqlite3 v0.20.2
9797
github.com/nektos/act v0.2.63
9898
github.com/niklasfasching/go-org v1.7.0
9999
github.com/olivere/elastic/v7 v7.0.32
@@ -255,6 +255,7 @@ require (
255255
github.com/markbates/going v1.0.3 // indirect
256256
github.com/mattn/go-colorable v0.1.13 // indirect
257257
github.com/mattn/go-runewidth v0.0.16 // indirect
258+
github.com/mattn/go-sqlite3 v1.14.24 // indirect
258259
github.com/mholt/acmez/v2 v2.0.3 // indirect
259260
github.com/miekg/dns v1.1.62 // indirect
260261
github.com/minio/md5-simd v1.1.2 // indirect
@@ -266,6 +267,7 @@ require (
266267
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
267268
github.com/mschoch/smat v0.2.0 // indirect
268269
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
270+
github.com/ncruces/julianday v1.0.0 // indirect
269271
github.com/nwaples/rardecode v1.1.3 // indirect
270272
github.com/oklog/ulid v1.3.1 // indirect
271273
github.com/olekukonko/tablewriter v0.0.5 // indirect
@@ -297,6 +299,7 @@ require (
297299
github.com/spf13/viper v1.19.0 // indirect
298300
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
299301
github.com/subosito/gotenv v1.6.0 // indirect
302+
github.com/tetratelabs/wazero v1.8.1 // indirect
300303
github.com/toqueteos/webbrowser v1.2.0 // indirect
301304
github.com/unknwon/com v1.0.1 // indirect
302305
github.com/valyala/fastjson v1.6.4 // indirect

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,10 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
641641
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
642642
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
643643
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
644+
github.com/ncruces/go-sqlite3 v0.20.2 h1:cMLIwrLZQuCWVCEOowSqlIlpzgbag3jnYVW4NM5u01M=
645+
github.com/ncruces/go-sqlite3 v0.20.2/go.mod h1:yL4ZNWGsr1/8pcLfpPW1RT1WFdvyeHonrgIwwi4rvkg=
646+
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
647+
github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
644648
github.com/niklasfasching/go-org v1.7.0 h1:vyMdcMWWTe/XmANk19F4k8XGBYg0GQ/gJGMimOjGMek=
645649
github.com/niklasfasching/go-org v1.7.0/go.mod h1:WuVm4d45oePiE0eX25GqTDQIt/qPW1T9DGkRscqLW5o=
646650
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
@@ -797,6 +801,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
797801
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
798802
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
799803
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
804+
github.com/tetratelabs/wazero v1.8.1 h1:NrcgVbWfkWvVc4UtT4LRLDf91PsOzDzefMdwhLfA550=
805+
github.com/tetratelabs/wazero v1.8.1/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs=
800806
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
801807
github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
802808
github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ=

models/activities/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ func DeleteIssueActions(ctx context.Context, repoID, issueID, issueIndex int64)
770770
// CountActionCreatedUnixString count actions where created_unix is an empty string
771771
func CountActionCreatedUnixString(ctx context.Context) (int64, error) {
772772
if setting.Database.Type.IsSQLite3() {
773-
return db.GetEngine(ctx).Where(`created_unix = ""`).Count(new(Action))
773+
return db.GetEngine(ctx).Where(`created_unix = ''`).Count(new(Action))
774774
}
775775
return 0, nil
776776
}

models/activities/action_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func TestConsistencyUpdateAction(t *testing.T) {
256256
unittest.AssertExistsAndLoadBean(t, &activities_model.Action{
257257
ID: int64(id),
258258
})
259-
_, err := db.GetEngine(db.DefaultContext).Exec(`UPDATE action SET created_unix = "" WHERE id = ?`, id)
259+
_, err := db.GetEngine(db.DefaultContext).Exec(`UPDATE action SET created_unix = '' WHERE id = ?`, id)
260260
assert.NoError(t, err)
261261
actions := make([]*activities_model.Action, 0, 1)
262262
//

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"
2931
)
3032

3133
// giteaRoot a path to the gitea root
@@ -203,7 +205,7 @@ type FixturesOptions struct {
203205

204206
// CreateTestEngine creates a memory database and loads the fixture data from fixturesDir
205207
func CreateTestEngine(opts FixturesOptions) error {
206-
x, err := xorm.NewEngine("sqlite3", "file::memory:?cache=shared&_txlock=immediate")
208+
x, err := xorm.NewEngine("sqlite3", "file:/data.db?vfs=memdb&_txlock=immediate")
207209
if err != nil {
208210
if strings.Contains(err.Error(), "unknown driver") {
209211
return fmt.Errorf(`sqlite3 requires: import _ "github.com/mattn/go-sqlite3" or -tags sqlite,sqlite_unlock_notify%s%w`, "\n", err)

modules/indexer/code/indexer_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222

2323
"github.com/stretchr/testify/assert"
2424
"github.com/stretchr/testify/require"
25-
26-
_ "github.com/mattn/go-sqlite3"
2725
)
2826

2927
type codeSearchResult struct {

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
@@ -130,7 +130,7 @@ func restoreOldDB(t *testing.T, version string) {
130130
err := os.MkdirAll(path.Dir(setting.Database.Path), os.ModePerm)
131131
assert.NoError(t, err)
132132

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

tests/test_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func InitTest(requireGitea bool) {
6161
_ = os.Setenv("GITEA_CONF", giteaConf)
6262
fmt.Printf("Environment variable $GITEA_CONF not set, use default: %s\n", giteaConf)
6363
if !setting.EnableSQLite3 {
64-
testlogger.Fatalf(`sqlite3 requires: import _ "github.com/mattn/go-sqlite3" or -tags sqlite,sqlite_unlock_notify` + "\n")
64+
testlogger.Fatalf(`sqlite3 requires: -tags sqlite,sqlite_unlock_notify` + "\n")
6565
}
6666
}
6767
if !filepath.IsAbs(giteaConf) {

0 commit comments

Comments
 (0)