mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Dm database create table primary key bug
This commit is contained in:
parent
bbada0467b
commit
339810de82
@ -458,13 +458,13 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
string sql = GetCreateTableSql(tableName, columns);
|
||||
string primaryKeyInfo = null;
|
||||
//string primaryKeyInfo = null;
|
||||
if (columns.Any(it => it.IsPrimarykey) && isCreatePrimaryKey)
|
||||
{
|
||||
primaryKeyInfo = string.Format(", Primary key({0})", string.Join(",", columns.Where(it => it.IsPrimarykey).Select(it => this.SqlBuilder.GetTranslationColumnName(it.DbColumnName.ToLower()))));
|
||||
|
||||
sql= sql.TrimEnd(')')+ string.Format(", Primary key({0})", string.Join(",", columns.Where(it => it.IsPrimarykey).Select(it => this.SqlBuilder.GetTranslationColumnName(it.DbColumnName.ToLower()))));
|
||||
sql = sql + ")";
|
||||
}
|
||||
sql = sql.Replace("$PrimaryKey", primaryKeyInfo);
|
||||
//sql = sql.Replace("$PrimaryKey", primaryKeyInfo);
|
||||
this.Context.Ado.ExecuteCommand(sql);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user