From dbab99a6d3a63083590a3bd995c7d55361d3d189 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 03:08:04 +0000 Subject: [PATCH] Bump gorm.io/driver/postgres from 1.5.9 to 1.5.11 Bumps [gorm.io/driver/postgres](https://github.com/go-gorm/postgres) from 1.5.9 to 1.5.11. - [Commits](https://github.com/go-gorm/postgres/compare/v1.5.9...v1.5.11) --- updated-dependencies: - dependency-name: gorm.io/driver/postgres dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- vendor/gorm.io/driver/postgres/migrator.go | 12 +++++++++++- vendor/modules.txt | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index a03e9b6315..43067a5249 100644 --- a/go.mod +++ b/go.mod @@ -58,8 +58,8 @@ require ( google.golang.org/grpc v1.64.1 google.golang.org/protobuf v1.34.1 gopkg.in/AlecAivazis/survey.v1 v1.8.8 - gorm.io/driver/postgres v1.5.9 gorm.io/driver/mysql v1.5.7 + gorm.io/driver/postgres v1.5.11 gorm.io/driver/sqlite v1.5.5 gorm.io/gorm v1.25.10 gvisor.dev/gvisor v0.0.0-20240306221502-ee1e1f6070e3 diff --git a/go.sum b/go.sum index ec34874363..7f912be7c6 100644 --- a/go.sum +++ b/go.sum @@ -578,10 +578,10 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/postgres v1.5.9 h1:DkegyItji119OlcaLjqN11kHoUgZ/j13E0jkJZgD6A8= -gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI= gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/driver/postgres v1.5.11 h1:ubBVAfbKEUld/twyKZ0IYn9rSQh448EdelLYk9Mv314= +gorm.io/driver/postgres v1.5.11/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI= gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/vendor/gorm.io/driver/postgres/migrator.go b/vendor/gorm.io/driver/postgres/migrator.go index df18db1b3e..2293a7cf18 100644 --- a/vendor/gorm.io/driver/postgres/migrator.go +++ b/vendor/gorm.io/driver/postgres/migrator.go @@ -142,6 +142,10 @@ func (m Migrator) CreateIndex(value interface{}, name string) error { createIndexSQL += " ?" } + if idx.Option != "" { + createIndexSQL += " " + idx.Option + } + if idx.Where != "" { createIndexSQL += " WHERE " + idx.Where } @@ -385,10 +389,16 @@ func (m Migrator) AlterColumn(value interface{}, field string) error { return err } } else { - if err := m.DB.Exec("ALTER TABLE ? ALTER COLUMN ? DROP DEFAULT", m.CurrentTable(stmt), clause.Column{Name: field.DBName}, clause.Expr{SQL: field.DefaultValue}).Error; err != nil { + if err := m.DB.Exec("ALTER TABLE ? ALTER COLUMN ? DROP DEFAULT", m.CurrentTable(stmt), clause.Column{Name: field.DBName}).Error; err != nil { return err } } + } else if !field.HasDefaultValue { + // case - as-is column has default value and to-be column has no default value + // need to drop default + if err := m.DB.Exec("ALTER TABLE ? ALTER COLUMN ? DROP DEFAULT", m.CurrentTable(stmt), clause.Column{Name: field.DBName}).Error; err != nil { + return err + } } } return nil diff --git a/vendor/modules.txt b/vendor/modules.txt index e1fac98118..537d838b44 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1076,7 +1076,7 @@ gopkg.in/yaml.v3 # gorm.io/driver/mysql v1.5.7 ## explicit; go 1.14 gorm.io/driver/mysql -# gorm.io/driver/postgres v1.5.9 +# gorm.io/driver/postgres v1.5.11 ## explicit; go 1.19 gorm.io/driver/postgres # gorm.io/driver/sqlite v1.5.5