Pārlūkot izejas kodu

mysql add column comment

xormplus 8 gadi atpakaļ
vecāks
revīzija
f7988c6149
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      statement.go

+ 4 - 0
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{}{}
 }