forked from mirror/gorm
Ignore those fields don't have valid sql type when auto migrate
This commit is contained in:
parent
272ad45943
commit
913757c103
4
do.go
4
do.go
|
@ -745,8 +745,8 @@ func (s *Do) autoMigrate() *Do {
|
|||
s.sqlVars = []interface{}{}
|
||||
|
||||
// If column doesn't exist
|
||||
if len(column_name) == 0 {
|
||||
s.sql = fmt.Sprintf("ALTER TABLE %v ADD %v %v", s.tableName(), field.DbName, field.SqlType)
|
||||
if len(column_name) == 0 && len(field.SqlType) > 0 {
|
||||
s.sql = fmt.Sprintf("ALTER TABLE %v ADD %v %v;", s.tableName(), field.DbName, field.SqlType)
|
||||
s.exec()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue