Exemplo n.º 1
0
        private void AnalyseTableDiff(EntityCollection <OracleTableList> table1, EntityCollection <OracleTableList> table2)
        {
            tableDiff           = new List <TableDiffInfo>();
            inTable1NotInTable2 = table1.Except(table2, new OracleTableListComparer()).ToList();
            bothIn2Table        = table1.Intersect(table2, new OracleTableListComparer()).ToList();
            inTable2NotInTable1 = table2.Except(table1, new OracleTableListComparer()).ToList();
            foreach (OracleTableList table in inTable1NotInTable2)
            {
                TableDiffInfo diff = new TableDiffInfo();
                diff.TableName = table.Owner + "." + table.TableName;
                //diff.DiffReason = "表在A库中存在但在B库中不存在";
                diff.DiffReason = "老库存在新库中没有的表";
                if (diff.UpdateSql == null)
                {
                    diff.UpdateSql = new List <string>();
                }
                diff.UpdateSql.Add(GetDDLForTable(table.TableName, table.Owner));
                tableDiff.Add(diff);
            }

            //foreach (OracleTableList table in inTable2NotInTable1)
            //{
            //    TableDiffInfo diff = new TableDiffInfo();
            //    diff.TableName = table.Owner + "." + table.TableName;
            //    diff.DiffReason = "表在B库中存在但在A库中不存在";
            //    tableDiff.Add(diff);
            //}
        }