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{}{}
|
s.sqlVars = []interface{}{}
|
||||||
|
|
||||||
// If column doesn't exist
|
// If column doesn't exist
|
||||||
if len(column_name) == 0 {
|
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.sql = fmt.Sprintf("ALTER TABLE %v ADD %v %v;", s.tableName(), field.DbName, field.SqlType)
|
||||||
s.exec()
|
s.exec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user