- 增加 ICodeFirst.SyncStructure(TableInfo) 重载方法迁移表结构;

This commit is contained in:
2881099
2023-11-24 22:39:27 +08:00
parent 2ed254d496
commit aad91e2172
29 changed files with 151 additions and 138 deletions

View File

@ -80,7 +80,7 @@ namespace FreeSql.Odbc.PostgreSQL
return null;
}
protected override string GetComparisonDDLStatements(params TypeAndName[] objects)
protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects)
{
var sb = new StringBuilder();
var seqcols = new List<NativeTuple<ColumnInfo, string[], bool>>(); //序列
@ -97,9 +97,9 @@ namespace FreeSql.Odbc.PostgreSQL
foreach (var obj in objects)
{
if (sb.Length > 0) sb.Append("\r\n");
var tb = _commonUtils.GetTableByEntity(obj.entityType);
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.entityType.FullName));
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.entityType.FullName));
var tb = obj.tableSchema;
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
var tbname = _commonUtils.SplitTableName(tb.DbName);
if (tbname?.Length == 1) tbname = new[] { "public", tbname[0] };