From 3ce855c23c2c5575c3736953bf6c0dd1c5892bd4 Mon Sep 17 00:00:00 2001 From: liutianqi Date: Sun, 18 Feb 2024 14:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E6=A8=A1=E5=9D=97=E4=BE=9D=E8=B5=96=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit go: upgraded gorm.io/gorm v1.25.6 => v1.25.7 Signed-off-by: liutianqi --- _dev/script/go-staticcheck.bat | 3 ++- create_test.go | 2 +- go.mod | 7 ++++++- migrator.go | 7 ++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/_dev/script/go-staticcheck.bat b/_dev/script/go-staticcheck.bat index 69da98c..5f3d722 100644 --- a/_dev/script/go-staticcheck.bat +++ b/_dev/script/go-staticcheck.bat @@ -8,7 +8,8 @@ echo cd /d %~dp0/../../ echo. & echo [golangci-lint.run] -go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run +rem go1.20 latest => v1.55.2 +go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 run echo. & echo [staticcheck.io] go run honnef.co/go/tools/cmd/staticcheck@latest -f text ./... diff --git a/create_test.go b/create_test.go index 1ee6f15..9d8e822 100644 --- a/create_test.go +++ b/create_test.go @@ -149,7 +149,7 @@ func TestMergeCreateUnique(t *testing.T) { t.Run("MergeCreateUnique", func(t *testing.T) { tx := db.Create(&data) if err = tx.Error; err != nil { - if strings.HasPrefix(err.Error(), "ORA-00001") { + if strings.Contains(err.Error(), "ORA-00001") { t.Log(err) // ORA-00001: 违反唯一约束条件 var gotData []TestTableUserUnique tx = db.Where(map[string]interface{}{"uid": []string{"U1", "U2"}}).Find(&gotData) diff --git a/go.mod b/go.mod index 6457949..46916b0 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,12 @@ go 1.16 require ( github.com/emirpasic/gods v1.18.1 github.com/sijms/go-ora/v2 v2.8.7 - gorm.io/gorm v1.25.6 + gorm.io/gorm v1.25.7 +) + +exclude ( + github.com/sijms/go-ora/v2 v2.8.8 // ORA-03137: 来自客户机的格式错误的 TTC 包被拒绝: [opiexe: protocol violation] + github.com/sijms/go-ora/v2 v2.8.9 // has bug ) retract ( diff --git a/migrator.go b/migrator.go index dbf78ab..99bd115 100644 --- a/migrator.go +++ b/migrator.go @@ -69,9 +69,10 @@ func (m Migrator) FullDataTypeOf(field *schema.Field) (expr clause.Expr) { expr.SQL += " NOT NULL" } - if field.Unique { - expr.SQL += " UNIQUE" - } + // see https://github.com/go-gorm/gorm/pull/6822 + //if field.Unique { + // expr.SQL += " UNIQUE" + //} return }