private void BuildChangeList()
        {
            _changedKeys.Clear();
            //Schemas
            if (_supportsSchemas)
            {
                /* - disabled, dropping schemas brings more trouble than it's worth
                 * //Old schemas to delete
                 * foreach(var oldSch in _oldModel.Schemas)
                 * if(!_newModel.ContainsSchema(oldSch.Name))
                 *  _changeSet.AddChange(oldSch, null);
                 */
                //New schemas to create
                foreach (var newSch in _newModel.Schemas)
                {
                    if (IsActive(newSch.Schema) && !_oldModel.ContainsSchema(newSch.Schema))
                    {
                        _upgradeInfo.AddChange(null, newSch);
                    }
                }
            }

            if (_compareTables)
            {
                // Tables - first go thru tables in old model
                foreach (var oldTbl in _oldModel.Tables)
                {
                    if (!IsActive(oldTbl.Schema))
                    {
                        continue;
                    }
                    var tblChangesGrp = AnalyzeTableChanges(oldTbl);
                    if (tblChangesGrp != null && tblChangesGrp.Changes.Count > 0) //if there are any changes inside, add tableChangeGroup
                    {
                        _upgradeInfo.TableChanges.Add(tblChangesGrp);
                    }
                }//foreach oldTbl
                // New tables -------------------------------------------------------------------------
                foreach (var newTbl in _newModel.Tables)
                {
                    if (!IsActive(newTbl.Schema))
                    {
                        continue;
                    }
                    if (newTbl.Peer != null)
                    {
                        continue; // we already processed it as table being changed
                    }
                    BuildNewTableChangeGroup(newTbl);
                } //foreach newTbl
            }     //if _compareTables

            //Ref constraints
            if (_useRefIntegrity)
            {
                foreach (var oldT in _oldModel.Tables)
                {
                    if (!IsActive(oldT.Schema))
                    {
                        continue;
                    }
                    if (oldT.Peer == null && !_dropUnknown)
                    {
                        continue; //ignore table
                    }
                    foreach (var refC in oldT.RefConstraints)
                    {
                        // Ref constraints were initially matched with peers. But now we might have detected changes in underlying keys;
                        // in this case the ref constraint should be set for recreation - by clearing Peers
                        if (refC.Peer != null && RefConstraintKeysChanged(refC))
                        {
                            refC.Peer.Peer = null;
                            refC.Peer      = null;
                        }
                        // Now check Peer; if null - drop it, and in the next loop the CREATE script will be added
                        if (refC.Peer == null)
                        {
                            _upgradeInfo.AddChange(refC, refC.Peer);
                        }
                    }//foreach refC in oldT
                }
                foreach (var newT in _newModel.Tables)
                {
                    if (!IsActive(newT.Schema))
                    {
                        continue;
                    }
                    foreach (var refC in newT.RefConstraints)
                    {
                        if (refC.Peer == null)
                        {
                            _upgradeInfo.AddChange(null, refC);
                        }
                    }
                }
            } //if _useRefIntegrity

            //Sequences
            foreach (var seq in _newModel.Sequences)
            {
                if (seq.Peer == null)
                {
                    _upgradeInfo.AddChange(null, seq);
                }
            }
            //Custom db types; we use it only for MS SQL, to add utility type (VITA_ArrayAsTable) that is used to pass arrays in parameters
            foreach (var tp in _newModel.CustomDbTypes)
            {
                if (tp.Peer == null)
                {
                    _upgradeInfo.AddChange(null, tp);
                }
            }
        }//method