mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 14:09:13 +00:00
53 lines
1.6 KiB
Diff
53 lines
1.6 KiB
Diff
diff --git a/tests/.gitignore b/tests/.gitignore
|
|
--- a/tests/.gitignore
|
|
+++ b/tests/.gitignore
|
|
@@ -1 +1 @@
|
|
-go.sum
|
|
+*
|
|
diff --git a/tests/go.mod b/tests/go.mod
|
|
--- a/tests/go.mod
|
|
+++ b/tests/go.mod
|
|
@@ -6,9 +6,10 @@ require (
|
|
github.com/google/uuid v1.3.0
|
|
github.com/jinzhu/now v1.1.5
|
|
github.com/lib/pq v1.10.9
|
|
+ github.com/ncruces/go-sqlite3 v0.8.3
|
|
+ github.com/ncruces/go-sqlite3/gormlite v0.0.0
|
|
gorm.io/driver/mysql v1.5.2-0.20230612053416-48b6526a21f0
|
|
gorm.io/driver/postgres v1.5.3-0.20230607070428-18bc84b75196
|
|
- gorm.io/driver/sqlite v1.5.2
|
|
gorm.io/driver/sqlserver v1.5.2-0.20230613072041-6e2cde390b0a
|
|
gorm.io/gorm v1.25.2
|
|
)
|
|
@@ -27,4 +28,4 @@ require (
|
|
golang.org/x/text v0.11.0 // indirect
|
|
)
|
|
|
|
-replace gorm.io/gorm => ../
|
|
+replace github.com/ncruces/go-sqlite3/gormlite => ../
|
|
diff --git a/tests/tests_test.go b/tests/tests_test.go
|
|
--- a/tests/tests_test.go
|
|
+++ b/tests/tests_test.go
|
|
@@ -7,9 +7,11 @@ import (
|
|
"path/filepath"
|
|
"time"
|
|
|
|
+ _ "github.com/ncruces/go-sqlite3/embed"
|
|
+ sqlite "github.com/ncruces/go-sqlite3/gormlite"
|
|
+
|
|
"gorm.io/driver/mysql"
|
|
"gorm.io/driver/postgres"
|
|
- "gorm.io/driver/sqlite"
|
|
"gorm.io/driver/sqlserver"
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm/logger"
|
|
@@ -89,7 +91,7 @@ func OpenTestConnection(cfg *gorm.Config) (db *gorm.DB, err error) {
|
|
db, err = gorm.Open(mysql.Open(dbDSN), cfg)
|
|
default:
|
|
log.Println("testing sqlite3...")
|
|
- db, err = gorm.Open(sqlite.Open(filepath.Join(os.TempDir(), "gorm.db?_foreign_keys=on")), cfg)
|
|
+ db, err = gorm.Open(sqlite.Open("file:"+filepath.Join(os.TempDir(), "gorm.db")+"?_pragma=busy_timeout(1000)&_pragma=foreign_keys(1)"), cfg)
|
|
}
|
|
|
|
if err != nil {
|