From e3bb4165dceb96b66053a067f9f3584302413a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8A=E1=B4=8F=E1=B4=87=20=E1=B4=84=CA=9C=E1=B4=87?= =?UTF-8?q?=C9=B4?= Date: Thu, 29 Jan 2026 14:49:36 -0500 Subject: [PATCH] database: impersonate pure-Go SQLite driver as the old "sqlite3" (#8118) --- go.mod | 2 +- internal/database/models.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 187ed049a..8b79225f8 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/internal/database/models.go b/internal/database/models.go index eb3e3d7f8..63b00e86d 100644 --- a/internal/database/models.go +++ b/internal/database/models.go @@ -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),