Update pgsql codefirst

This commit is contained in:
sunkaixuan 2023-12-20 22:53:49 +08:00
parent 2e2d4d2522
commit d32f269d51

View File

@ -419,6 +419,7 @@ WHERE tgrelid = '"+tableName+"'::regclass");
{
foreach (var item in columns)
{
ConvertCreateColumnInfo(item);
if (item.DbColumnName.Equals("GUID", StringComparison.CurrentCultureIgnoreCase) && item.Length == 0)
{
item.Length = 10;
@ -578,7 +579,16 @@ WHERE tgrelid = '"+tableName+"'::regclass");
return schema;
}
private static void ConvertCreateColumnInfo(DbColumnInfo x)
{
string[] array = new string[] { "int4", "text", "int2", "int8", "date", "bit", "text", "timestamp" };
if (array.Contains(x.DataType?.ToLower()))
{
x.Length = 0;
x.DecimalDigits = 0;
}
}
#endregion
}
}