Red Gate forums :: View topic - Ignore Custom db Objects
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

Ignore Custom db Objects

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
IndyNotesGuy



Joined: 27 Sep 2008
Posts: 1
Location: Indianapolis, IN

PostPosted: Sat Sep 27, 2008 11:10 am    Post subject: Ignore Custom db Objects Reply with quote

Ok I am stumped, here is what I am trying to do:

We have a database based off another vendors schema, we take that orginial schema and add custom tables, stored procedures, functions, etc. I am trying to build a project to re-sync the core back to the orginial schema, I do not however want to drop any of the custom items we may have added.

I just want to drop any custom indexes we may have placed on the orginial database tables, and then add any new db objects the vendors database now has.

I have played with a foreach loop, looping through the differences and excluding objects which only exists in Production database, but that excludes any custom indexes we may have added.

So basically I just want to compare items that exist in both schema, what am I missing?

Thanks.
Back to top
View user's profile Send private message Yahoo Messenger
eddie davis



Joined: 14 Jun 2006
Posts: 925
Location: Red Gate Software

PostPosted: Tue Sep 30, 2008 5:04 pm    Post subject: Reply with quote

Thank you for your post into the forum.

To achieve the results you are looking for you will need to perform two comparison and synchronizations.

The first comparison and synchronization you need to use the Ignore Indexes option.
Code:
            Database db1=new Database();
            Database db2=new Database();
             
            db1.Register(new ConnectionProperties(".", "WidgetStaging"), Options.Default);
            db2.Register(new ConnectionProperties(".", "WidgetProduction"), Options.Default);
             
            Differences differences=db1.CompareWith(db2, Options.Default | Options.IgnoreIndexes); //Using the default options and the Ignore Indexes option
             
            foreach (Difference difference in differences)
            {
                Console.WriteLine("{0} {1} {2}", difference.Type.ToString(), difference.DatabaseObjectType.ToString(), difference.Name);
            }
             
            //dispose of the objects
            db1.Dispose();
            db2.Dispose();


As the Ignore Indexes will also remove any indexes you have set on your new custom tables.

Perform another Comparison and Synchronization and only include the new custom tables with the Ignore Indexes removed. When the synchronization is run it will add the indexes you configured for the new tables.

Many Thanks
Eddie
_________________
Eddie Davis
Technical Support Engineer
Red Gate Software Ltd
E-mail: support@red-gate.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group