mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 恢复 MySql ServerTime = Utc ;#1604 #1624
This commit is contained in:
parent
be6f2fa9c2
commit
9e3b258ffd
@ -258,9 +258,14 @@ namespace FreeSql.Internal
|
|||||||
commonNow = $"{commonNow.TrimEnd('(', ')')}({timeLength})";
|
commonNow = $"{commonNow.TrimEnd('(', ')')}({timeLength})";
|
||||||
commonNowUtc = $"{commonNowUtc.TrimEnd('(', ')')}({timeLength})";
|
commonNowUtc = $"{commonNowUtc.TrimEnd('(', ')')}({timeLength})";
|
||||||
}
|
}
|
||||||
|
//https://github.com/dotnetcore/FreeSql/issues/1604 mysql 不支持默认值 utc_timestamp DDL
|
||||||
|
if (colattr.ServerTime == DateTimeKind.Local)
|
||||||
|
col.DbDefaultValue = commonNow;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
col.DbDefaultValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
col.DbDefaultValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
|
|
||||||
col.DbInsertValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
|
col.DbInsertValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
|
||||||
col.DbUpdateValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
|
col.DbUpdateValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ namespace FreeSql.Custom.MySql
|
|||||||
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
||||||
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
||||||
public override string Now => "now()";
|
public override string Now => "now()";
|
||||||
public override string NowUtc => "current_timestamp()";
|
public override string NowUtc => "utc_timestamp()";
|
||||||
|
|
||||||
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ namespace FreeSql.MySql
|
|||||||
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
||||||
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
||||||
public override string Now => "now()";
|
public override string Now => "now()";
|
||||||
public override string NowUtc => "current_timestamp()";
|
public override string NowUtc => "utc_timestamp()";
|
||||||
|
|
||||||
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ namespace FreeSql.MySql
|
|||||||
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
||||||
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
||||||
public override string Now => "now()";
|
public override string Now => "now()";
|
||||||
public override string NowUtc => "current_timestamp()";
|
public override string NowUtc => "utc_timestamp()";
|
||||||
|
|
||||||
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
public override string Mod(string left, string right, Type leftType, Type rightType) => $"{left} % {right}";
|
||||||
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
public override string Div(string left, string right, Type leftType, Type rightType) => $"{left} div {right}";
|
||||||
public override string Now => "now()";
|
public override string Now => "now()";
|
||||||
public override string NowUtc => "current_timestamp()";
|
public override string NowUtc => "utc_timestamp()";
|
||||||
|
|
||||||
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
public override string QuoteWriteParamterAdapter(Type type, string paramterName)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user