mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update ClickHouse
This commit is contained in:
@@ -253,10 +253,14 @@ namespace SqlSugar.ClickHouse
|
|||||||
{
|
{
|
||||||
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
|
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
|
||||||
var columnName= this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
|
var columnName= this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
|
||||||
string sql = GetUpdateColumnSql(tableName, columnInfo);
|
if (columnInfo.IsNullable)
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
{
|
||||||
var isnull = columnInfo.IsNullable?" DROP NOT NULL ": " SET NOT NULL ";
|
if (!columnInfo.DataType.ObjToString().ToLower().Contains("nullable"))
|
||||||
this.Context.Ado.ExecuteCommand(string.Format("alter table {0} alter {1} {2}",tableName,columnName, isnull));
|
{
|
||||||
|
columnInfo.DataType = $"Nullable({columnInfo.DataType})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Context.Ado.ExecuteCommand(string.Format("ALTER TABLE {0} MODIFY COLUMN {1} {2} ", tableName,columnName,columnInfo.DataType));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user