Update CodeFirst

This commit is contained in:
sunkaixuan 2024-01-19 14:45:20 +08:00
parent 384af91b02
commit 2a64002ed2

View File

@ -393,6 +393,7 @@ namespace SqlSugar
if (entityInfo.IsCreateTableFiledSort) if (entityInfo.IsCreateTableFiledSort)
{ {
columns = columns.OrderBy(c => c.CreateTableFieldSort).ToList(); columns = columns.OrderBy(c => c.CreateTableFieldSort).ToList();
columns = columns.OrderBy(it => it.IsPrimarykey ? 0 : 1).ToList();
} }
} }
this.Context.DbMaintenance.CreateTable(tableName, columns, true); this.Context.DbMaintenance.CreateTable(tableName, columns, true);