Merge pull request #119 from admpub/master

bug fixed
This commit is contained in:
S.W.H 2014-05-05 23:29:52 +08:00
commit 2402f9b4f3
1 changed files with 7 additions and 0 deletions

View File

@ -151,6 +151,9 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column
if colDefault != nil { if colDefault != nil {
col.Default = *colDefault col.Default = *colDefault
if col.Default == "" {
col.DefaultIsEmpty = true
}
} }
cts := strings.Split(colType, "(") cts := strings.Split(colType, "(")
@ -203,6 +206,10 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column
if col.SQLType.IsText() { if col.SQLType.IsText() {
if col.Default != "" { if col.Default != "" {
col.Default = "'" + col.Default + "'" col.Default = "'" + col.Default + "'"
} else {
if col.DefaultIsEmpty {
col.Default = "''"
}
} }
} }
cols[col.Name] = col cols[col.Name] = col