From 5af80770ea5f3653018562412f1d338c92e2b836 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 16 Feb 2015 21:12:22 +0800 Subject: [PATCH] bug fixed #210 --- engine.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine.go b/engine.go index 5c55b4b1..304caedb 100644 --- a/engine.go +++ b/engine.go @@ -773,7 +773,11 @@ func (engine *Engine) mapType(v reflect.Value) *core.Table { col.IsPrimaryKey = true col.Nullable = false case k == "NULL": - col.Nullable = (strings.ToUpper(tags[j-1]) != "NOT") + if j == 0 { + col.Nullable = true + } else { + col.Nullable = (strings.ToUpper(tags[j-1]) != "NOT") + } /*case strings.HasPrefix(k, "AUTOINCR(") && strings.HasSuffix(k, ")"): col.IsAutoIncrement = true