From f7988c614941fde37beaf5a77529e9d6da7bea9a Mon Sep 17 00:00:00 2001 From: xormplus <xormplus@163.com> Date: Wed, 22 Nov 2017 09:59:47 +0800 Subject: [PATCH] mysql add column comment --- statement.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/statement.go b/statement.go index 0ec458c..579eaf7 100644 --- a/statement.go +++ b/statement.go @@ -909,6 +909,10 @@ func (statement *Statement) genAddColumnStr(col *core.Column) (string, []interfa quote := statement.Engine.Quote sql := fmt.Sprintf("ALTER TABLE %v ADD %v;", quote(statement.TableName()), col.String(statement.Engine.dialect)) + if statement.Engine.dialect.DBType() == core.MYSQL && len(col.Comment) > 0 { + sql += " COMMENT '" + col.Comment + "'" + } + sql += ";" return sql, []interface{}{} }