mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Mysql创建表时,增加字段注释。
This commit is contained in:
parent
42e736b874
commit
807aec33a8
@ -11,8 +11,9 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
[SugarColumn(ColumnDescription ="名称")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
[SugarColumn(ColumnDescription = "价格")]
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
@ -392,6 +392,10 @@ namespace SqlSugar
|
|||||||
string primaryKey = null;
|
string primaryKey = null;
|
||||||
string identity = item.IsIdentity ? this.CreateTableIdentity : null;
|
string identity = item.IsIdentity ? this.CreateTableIdentity : null;
|
||||||
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName), dataType, dataSize, nullType, primaryKey, identity);
|
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName), dataType, dataSize, nullType, primaryKey, identity);
|
||||||
|
if (!string.IsNullOrEmpty(item.ColumnDescription))
|
||||||
|
{
|
||||||
|
addItem += "COMMENT '"+item.ColumnDescription+"' ";
|
||||||
|
}
|
||||||
columnArray.Add(addItem);
|
columnArray.Add(addItem);
|
||||||
}
|
}
|
||||||
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
||||||
|
Loading…
Reference in New Issue
Block a user