Skip to content

Commit

Permalink
mysql add column comment
Browse files Browse the repository at this point in the history
  • Loading branch information
xormplus committed Nov 22, 2017
1 parent e0e2d41 commit f7988c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{}
}

Expand Down

0 comments on commit f7988c6

Please sign in to comment.