mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Update TDengine CodeFirst
This commit is contained in:
@@ -119,7 +119,7 @@ namespace SqlSugar.TDengine
|
||||
public override void NoExistLogic(EntityInfo entityInfo)
|
||||
{
|
||||
List<DbColumnInfo> dbColumns = new List<DbColumnInfo>();
|
||||
foreach (var item in entityInfo.Columns.OrderBy(it=>it.UnderType==typeof(DateTime)?0:1))
|
||||
foreach (var item in entityInfo.Columns.Where(it=>it.PropertyName!= "TagsTypeId").OrderBy(it=>it.UnderType==typeof(DateTime)?0:1))
|
||||
{
|
||||
var addItem = EntityColumnToDbColumn(entityInfo, entityInfo.DbTableName, item);
|
||||
dbColumns.Add(addItem);
|
||||
@@ -160,6 +160,12 @@ namespace SqlSugar.TDengine
|
||||
return "FLOAT";
|
||||
case "int":
|
||||
return "INT";
|
||||
case "int32":
|
||||
return "INT";
|
||||
case "int16":
|
||||
return "INT";
|
||||
case "int64":
|
||||
return "BIGINT";
|
||||
case "uint":
|
||||
return "INT UNSIGNED";
|
||||
case "long":
|
||||
|
@@ -88,7 +88,7 @@ namespace SqlSugar.TDengine
|
||||
{
|
||||
get
|
||||
{
|
||||
return "CREATE STABLE IF NOT EXISTS {0}(\r\n{1} ) TAGS(TagsTypeId VARCHAR(20))";
|
||||
return "CREATE STABLE IF NOT EXISTS {0}(\r\n{1} ) TAGS("+SqlBuilder.GetTranslationColumnName("TagsTypeId") +" VARCHAR(20))";
|
||||
}
|
||||
}
|
||||
protected override string CreateTableColumn
|
||||
@@ -193,14 +193,14 @@ namespace SqlSugar.TDengine
|
||||
{
|
||||
get
|
||||
{
|
||||
return "DEFAULT NULL";
|
||||
return " ";
|
||||
}
|
||||
}
|
||||
protected override string CreateTableNotNull
|
||||
{
|
||||
get
|
||||
{
|
||||
return "NOT NULL";
|
||||
return " ";
|
||||
}
|
||||
}
|
||||
protected override string CreateTablePirmaryKey
|
||||
@@ -220,6 +220,23 @@ namespace SqlSugar.TDengine
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public override bool AddColumn(string tableName, DbColumnInfo columnInfo)
|
||||
{
|
||||
if (columnInfo.DbColumnName == "TagsTypeId")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
|
||||
var isAddNotNUll = columnInfo.IsNullable == false && columnInfo.DefaultValue.HasValue();
|
||||
if (isAddNotNUll)
|
||||
{
|
||||
columnInfo = this.Context.Utilities.TranslateCopy(columnInfo);
|
||||
columnInfo.IsNullable = true;
|
||||
}
|
||||
string sql = GetAddColumnSql(tableName, columnInfo);
|
||||
this.Context.Ado.ExecuteCommand(sql);
|
||||
return true;
|
||||
}
|
||||
public override List<DbTableInfo> GetViewInfoList(bool isCache = true)
|
||||
{
|
||||
return new List<DbTableInfo>();
|
||||
|
Reference in New Issue
Block a user