bug fixed

Signed-off-by: 商讯在线 <swhbox@foxmail.com>
This commit is contained in:
商讯在线 2014-05-05 23:08:17 +08:00
parent 7bbbcba21b
commit f133c00223
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