mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-26 22:25:49 +08:00
SqlServer CodeFirst default value bug
This commit is contained in:
@@ -313,6 +313,21 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
|
||||
{
|
||||
if (defaultValue == "''")
|
||||
{
|
||||
defaultValue = "";
|
||||
}
|
||||
var template = AddDefaultValueSql;
|
||||
if (defaultValue != null && defaultValue.ToLower() == "getdate()")
|
||||
{
|
||||
template = template.Replace("'{2}'", "{2}");
|
||||
}
|
||||
string sql = string.Format(template, tableName, columnName, defaultValue);
|
||||
this.Context.Ado.ExecuteCommand(sql);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///by current connection string
|
||||
|
||||
Reference in New Issue
Block a user