From f133c00223627d3182d0c29c657fcf353a03b10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=95=86=E8=AE=AF=E5=9C=A8=E7=BA=BF?= Date: Mon, 5 May 2014 23:08:17 +0800 Subject: [PATCH] bug fixed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 商讯在线 --- mysql_dialect.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql_dialect.go b/mysql_dialect.go index 66107c47..637a4af2 100644 --- a/mysql_dialect.go +++ b/mysql_dialect.go @@ -151,6 +151,9 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column if colDefault != nil { col.Default = *colDefault + if col.Default == "" { + col.DefaultIsEmpty = true + } } 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.Default != "" { col.Default = "'" + col.Default + "'" + } else { + if col.DefaultIsEmpty { + col.Default = "''" + } } } cols[col.Name] = col