database: impersonate pure-Go SQLite driver as the old "sqlite3" (#8118)

This commit is contained in:
ᴊᴏᴇ ᴄʜᴇɴ
2026-01-29 14:49:36 -05:00
committed by GitHub
parent df3d945a2c
commit e3bb4165dc
2 changed files with 5 additions and 1 deletions

2
go.mod
View File

@@ -7,6 +7,7 @@ require (
github.com/cockroachdb/errors v1.12.0
github.com/derision-test/go-mockgen/v2 v2.1.1
github.com/editorconfig/editorconfig-core-go/v2 v2.6.3
github.com/glebarez/go-sqlite v1.21.2
github.com/glebarez/sqlite v1.11.0
github.com/go-ldap/ldap/v3 v3.4.11
github.com/go-macaron/binding v1.2.0
@@ -80,7 +81,6 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect

View File

@@ -11,6 +11,7 @@ import (
"time"
"github.com/cockroachdb/errors"
"github.com/glebarez/go-sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
log "unknwon.dev/clog/v2"
@@ -45,6 +46,9 @@ var (
)
func init() {
// Register the pure-Go SQLite driver as "sqlite3" for XORM compatibility.
sql.Register("sqlite3", &sqlite.Driver{})
legacyTables = append(legacyTables,
new(User), new(PublicKey), new(TwoFactor), new(TwoFactorRecoveryCode),
new(Repository), new(DeployKey), new(Collaboration), new(Upload),