- 优化 CodeFirst 字段变化对比逻辑

This commit is contained in:
28810
2020-05-26 02:50:21 +08:00
parent 1ac13d6327
commit 0d6ebc1e26
13 changed files with 199 additions and 185 deletions

View File

@ -226,6 +226,7 @@ where a.owner={{0}} and a.table_name={{1}}", tboldname ?? tbname);
if (tbcol.Attribute.DbType.StartsWith("varchar", StringComparison.CurrentCultureIgnoreCase) && tbstructcol.sqlType.StartsWith("varchar2", StringComparison.CurrentCultureIgnoreCase)
&& Regex.Match(tbcol.Attribute.DbType, @"\(\d+").Groups[0].Value == Regex.Match(tbstructcol.sqlType, @"\(\d+").Groups[0].Value)
istmpatler = false;
if (istmpatler) break;
}
//sbalter.Append("execute immediate 'ALTER TABLE ").Append(_commonUtils.QuoteSqlName($"{tbname[0]}.{tbname[1]}")).Append(" MODIFY (").Append(_commonUtils.QuoteSqlName(tbstructcol.column)).Append(" ").Append(dbtypeNoneNotNull).Append(")';\r\n");
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)
@ -259,7 +260,9 @@ where a.owner={{0}} and a.table_name={{1}}", tboldname ?? tbname);
if (tbcol.Attribute.IsIdentity == true) seqcols.Add(NaviteTuple.Create(tbcol, tbname, tbcol.Attribute.IsIdentity == true));
if (string.IsNullOrEmpty(tbcol.Comment) == false) sbalter.Append("execute immediate 'COMMENT ON COLUMN ").Append(_commonUtils.QuoteSqlName($"{tbname[0]}.{tbname[1]}.{tbcol.Attribute.Name}")).Append(" IS ").Append(_commonUtils.FormatSql("{0}", tbcol.Comment ?? "").Replace("'", "''")).Append("';\r\n");
}
}
if (istmpatler == false)
{
CreateOracleFunction(_orm);
var dsuksql = _commonUtils.FormatSql(@"
select