mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-23 13:21:59 +08:00
Update 达梦 Codefirst
This commit is contained in:
@@ -267,6 +267,33 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
public override bool UpdateColumn(string tableName, DbColumnInfo column)
|
||||||
|
{
|
||||||
|
var oldColumn = this.Context.DbMaintenance.GetColumnInfosByTableName(tableName, false)
|
||||||
|
.FirstOrDefault(it => it.DbColumnName.EqualCase(column.DbColumnName));
|
||||||
|
if (oldColumn != null)
|
||||||
|
{
|
||||||
|
if (oldColumn.IsNullable == column.IsNullable)
|
||||||
|
{
|
||||||
|
var sql = GetUpdateColumnSqlOnlyType(tableName, column);
|
||||||
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return base.UpdateColumn(tableName, column);
|
||||||
|
}
|
||||||
|
protected virtual string GetUpdateColumnSqlOnlyType(string tableName, DbColumnInfo columnInfo)
|
||||||
|
{
|
||||||
|
string columnName = this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
|
||||||
|
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
|
||||||
|
string dataSize = GetSize(columnInfo);
|
||||||
|
string dataType = columnInfo.DataType;
|
||||||
|
string nullType = "";
|
||||||
|
string primaryKey = null;
|
||||||
|
string identity = null;
|
||||||
|
string result = string.Format(this.AlterColumnToTableSql, tableName, columnName, dataType, dataSize, nullType, primaryKey, identity);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
public override List<string> GetDbTypes()
|
public override List<string> GetDbTypes()
|
||||||
{
|
{
|
||||||
var result = this.Context.Ado.SqlQuery<string>(@"SELECT DISTINCT DATA_TYPE
|
var result = this.Context.Ado.SqlQuery<string>(@"SELECT DISTINCT DATA_TYPE
|
||||||
|
|||||||
Reference in New Issue
Block a user