Synchronization code

This commit is contained in:
sunkaixuan
2025-02-17 10:37:36 +08:00
parent 39f2bfd16a
commit 7f98674a77

View File

@@ -215,6 +215,10 @@ namespace SqlSugar
{ {
get get
{ {
if (IsSqlServerModel())
{
return "ALTER TABLE {0} ALTER {1} SET DEFAULT {2}";
}
return "ALTER TABLE {0} ALTER COLUMN {1} SET DEFAULT {2}"; return "ALTER TABLE {0} ALTER COLUMN {1} SET DEFAULT {2}";
} }
} }
@@ -665,7 +669,7 @@ WHERE tgrelid = '" + tableName + "'::regclass");
} }
} }
} }
private static void ConvertCreateColumnInfo(DbColumnInfo x) private void ConvertCreateColumnInfo(DbColumnInfo x)
{ {
string[] array = new string[] { "int4", "text", "int2", "int8", "date", "bit", "text", "timestamp" }; string[] array = new string[] { "int4", "text", "int2", "int8", "date", "bit", "text", "timestamp" };
@@ -674,6 +678,16 @@ WHERE tgrelid = '" + tableName + "'::regclass");
x.Length = 0; x.Length = 0;
x.DecimalDigits = 0; x.DecimalDigits = 0;
} }
if (IsSqlServerModel())
{
if (x.DataType=="int8")
{
x.DataType = "bigint";
x.Length = 0;
x.Scale = 0;
}
}
} }
private bool IsPgModel() private bool IsPgModel()
{ {