- 恢复 MySql ServerTime = Utc ;#1604 #1624

This commit is contained in:
2881099
2023-09-21 20:08:17 +08:00
parent be6f2fa9c2
commit 9e3b258ffd
5 changed files with 10 additions and 5 deletions

View File

@ -258,9 +258,14 @@ namespace FreeSql.Internal
commonNow = $"{commonNow.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;
}
col.DbDefaultValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
col.DbInsertValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
col.DbUpdateValue = colattr.ServerTime == DateTimeKind.Local ? commonNow : commonNowUtc;
}