Update pgsql

This commit is contained in:
sunkaixuna
2021-08-27 15:16:52 +08:00
parent e91eb23279
commit 8cc8c2b345
2 changed files with 9 additions and 0 deletions

View File

@@ -37,6 +37,11 @@ namespace SqlSugar
ColumnDescription = item.ColumnDescription, ColumnDescription = item.ColumnDescription,
Length = item.Length Length = item.Length
}; };
if (propertyType == UtilConstants.DecType)
{
result.Scale = item.DecimalDigits;
result.DecimalDigits = item.DecimalDigits;
}
GetDbType(item, propertyType, result); GetDbType(item, propertyType, result);
if (result.DataType.Equals("varchar", StringComparison.CurrentCultureIgnoreCase) && result.Length == 0) if (result.DataType.Equals("varchar", StringComparison.CurrentCultureIgnoreCase) && result.Length == 0)
{ {

View File

@@ -360,6 +360,10 @@ namespace SqlSugar
dataType = "varchar"; dataType = "varchar";
} }
string dataSize = item.Length > 0 ? string.Format("({0})", item.Length) : null; string dataSize = item.Length > 0 ? string.Format("({0})", item.Length) : null;
if (item.DecimalDigits > 0&&item.Length>0 && dataType == "numeric")
{
dataSize = $"({item.Length},{item.DecimalDigits})";
}
string nullType = item.IsNullable ? this.CreateTableNull : CreateTableNotNull; string nullType = item.IsNullable ? this.CreateTableNull : CreateTableNotNull;
string primaryKey = null; string primaryKey = null;
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower()), dataType, dataSize, nullType, primaryKey, ""); string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower()), dataType, dataSize, nullType, primaryKey, "");