From 7cd4078f0b35ac497ec3cf1b8caf3327f0d38440 Mon Sep 17 00:00:00 2001 From: zy Date: Mon, 6 Nov 2017 14:23:03 +0800 Subject: [PATCH] fix: oracle default key in xorm tag error (#30) --- column.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/column.go b/column.go index d9362e98..65370bb5 100644 --- a/column.go +++ b/column.go @@ -79,6 +79,10 @@ func (col *Column) String(d Dialect) string { } } + if col.Default != "" { + sql += "DEFAULT " + col.Default + " " + } + if d.ShowCreateNull() { if col.Nullable { sql += "NULL " @@ -87,10 +91,6 @@ func (col *Column) String(d Dialect) string { } } - if col.Default != "" { - sql += "DEFAULT " + col.Default + " " - } - return sql } @@ -99,6 +99,10 @@ func (col *Column) StringNoPk(d Dialect) string { sql += d.SqlType(col) + " " + if col.Default != "" { + sql += "DEFAULT " + col.Default + " " + } + if d.ShowCreateNull() { if col.Nullable { sql += "NULL " @@ -107,10 +111,6 @@ func (col *Column) StringNoPk(d Dialect) string { } } - if col.Default != "" { - sql += "DEFAULT " + col.Default + " " - } - return sql }