Skip to content

Commit cee4249

Browse files
committed
fix
1 parent fa175c1 commit cee4249

File tree

12 files changed

+39
-12
lines changed

12 files changed

+39
-12
lines changed

assets/go-licenses.json

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

+4-1
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

+6
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -770,15 +770,15 @@ 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
}
777777

778778
// FixActionCreatedUnixString set created_unix to zero if it is an empty string
779779
func FixActionCreatedUnixString(ctx context.Context) (int64, error) {
780780
if setting.Database.Type.IsSQLite3() {
781-
res, err := db.GetEngine(ctx).Exec(`UPDATE action SET created_unix = 0 WHERE created_unix = ""`)
781+
res, err := db.GetEngine(ctx).Exec(`UPDATE action SET created_unix = 0 WHERE created_unix = ''`)
782782
if err != nil {
783783
return 0, err
784784
}

models/activities/action_test.go

+1-1
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/issues/label_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func TestDeleteIssueLabel(t *testing.T) {
406406
PosterID: doerID,
407407
IssueID: issueID,
408408
LabelID: labelID,
409-
}, `content=""`)
409+
}, `content=''`)
410410
label = unittest.AssertExistsAndLoadBean(t, &issues_model.Label{ID: labelID})
411411
assert.EqualValues(t, expectedNumIssues, label.NumIssues)
412412
assert.EqualValues(t, expectedNumClosedIssues, label.NumClosedIssues)

models/unittest/testdb.go

+3-1
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
// 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

-2
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

+1-1
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

+4-1
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

+1-1
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

+1-1
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)