diff --git a/go.mod b/go.mod index 5cacb2e521..91fef3e928 100644 --- a/go.mod +++ b/go.mod @@ -58,7 +58,7 @@ 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/mysql v1.5.6 + gorm.io/driver/mysql v1.5.7 gorm.io/driver/postgres v1.5.7 gorm.io/driver/sqlite v1.5.5 gorm.io/gorm v1.25.10 diff --git a/go.sum b/go.sum index 4db757a329..9e9c8112d1 100644 --- a/go.sum +++ b/go.sum @@ -578,8 +578,8 @@ 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/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= -gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +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.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM= gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= diff --git a/vendor/gorm.io/driver/mysql/migrator.go b/vendor/gorm.io/driver/mysql/migrator.go index fcdb63c5a1..e266cfdcec 100644 --- a/vendor/gorm.io/driver/mysql/migrator.go +++ b/vendor/gorm.io/driver/mysql/migrator.go @@ -155,7 +155,7 @@ func (m Migrator) AlterColumn(value interface{}, field string) error { return m.DB.Exec( "ALTER TABLE ? MODIFY COLUMN ? ?", - clause.Table{Name: stmt.Table}, clause.Column{Name: field.DBName}, fullDataType, + m.CurrentTable(stmt), clause.Column{Name: field.DBName}, fullDataType, ).Error } } @@ -215,7 +215,7 @@ func (m Migrator) RenameColumn(value interface{}, oldName, newName string) error if field != nil { return m.DB.Exec( "ALTER TABLE ? CHANGE ? ? ?", - clause.Table{Name: stmt.Table}, clause.Column{Name: oldName}, + m.CurrentTable(stmt), clause.Column{Name: oldName}, clause.Column{Name: newName}, m.FullDataTypeOf(field), ).Error } @@ -252,7 +252,7 @@ func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error return m.RunWithValue(value, func(stmt *gorm.Statement) error { return m.DB.Exec( "ALTER TABLE ? RENAME INDEX ? TO ?", - clause.Table{Name: stmt.Table}, clause.Column{Name: oldName}, clause.Column{Name: newName}, + m.CurrentTable(stmt), clause.Column{Name: oldName}, clause.Column{Name: newName}, ).Error }) } @@ -267,7 +267,7 @@ func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error if idx := stmt.Schema.LookIndex(newName); idx == nil { if idx = stmt.Schema.LookIndex(oldName); idx != nil { opts := m.BuildIndexOptions(idx.Fields, stmt) - values := []interface{}{clause.Column{Name: newName}, clause.Table{Name: stmt.Table}, opts} + values := []interface{}{clause.Column{Name: newName}, m.CurrentTable(stmt), opts} createIndexSQL := "CREATE " if idx.Class != "" { @@ -295,7 +295,7 @@ func (m Migrator) DropTable(values ...interface{}) error { tx.Exec("SET FOREIGN_KEY_CHECKS = 0;") for i := len(values) - 1; i >= 0; i-- { if err := m.RunWithValue(values[i], func(stmt *gorm.Statement) error { - return tx.Exec("DROP TABLE IF EXISTS ? CASCADE", clause.Table{Name: stmt.Table}).Error + return tx.Exec("DROP TABLE IF EXISTS ? CASCADE", m.CurrentTable(stmt)).Error }); err != nil { return err } diff --git a/vendor/gorm.io/driver/mysql/mysql.go b/vendor/gorm.io/driver/mysql/mysql.go index bdef77bbf3..8b6ef3dbae 100644 --- a/vendor/gorm.io/driver/mysql/mysql.go +++ b/vendor/gorm.io/driver/mysql/mysql.go @@ -22,6 +22,8 @@ import ( ) const ( + DefaultDriverName = "mysql" + AutoRandomTag = "auto_random()" // Treated as an auto_random field for tidb ) @@ -80,7 +82,7 @@ func New(config Config) gorm.Dialector { } func (dialector Dialector) Name() string { - return "mysql" + return DefaultDriverName } // NowFunc return now func @@ -107,7 +109,7 @@ func (dialector Dialector) Apply(config *gorm.Config) error { func (dialector Dialector) Initialize(db *gorm.DB) (err error) { if dialector.DriverName == "" { - dialector.DriverName = "mysql" + dialector.DriverName = DefaultDriverName } if dialector.DefaultDatetimePrecision == nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index a1dafd3957..f353d405b7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1071,7 +1071,7 @@ gopkg.in/jcmturner/rpc.v1/ndr # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# gorm.io/driver/mysql v1.5.6 +# gorm.io/driver/mysql v1.5.7 ## explicit; go 1.14 gorm.io/driver/mysql # gorm.io/driver/postgres v1.5.7