Undo

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Undo

Postby mtran » Tue Nov 04, 2008 12:55 am

Is there anyway to undo a successful synchronization of both SQL Compare and SQL Data Compare?
mtran
 
Posts: 25
Joined: Tue Oct 07, 2008 6:55 pm

Postby Chris Auckland » Tue Nov 04, 2008 6:24 pm

Unfortunately not, the changes made are permanent.

The only way to reverse the changes would be to restore from a backup.
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Postby Simon C » Tue Nov 04, 2008 7:01 pm

In the future, you can create a rollback script when you create the initial sync script by creating a new Work class with the runOnTwo argument to the BuildFromDifferences method negated. This will produce a sync script going the other way, if you wanted to undo the changes made by the first script.

Simon C
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software

Postby mtran » Wed Nov 05, 2008 4:19 pm

So to create the undo script:
Code: Select all
           
            Work work = new Work();
            work.BuildFromDifferences(difference, Options.Default, false);
            using (ExecutionBlock block = work.ExecutionBlock)
            {
                string sql = block.GetString();
                difference.Database1.Dispose();
                difference.Database2.Dispose();               
                return sql;
            }


I just need to set that flag to false?

Thanks,
Meng
mtran
 
Posts: 25
Joined: Tue Oct 07, 2008 6:55 pm

Postby Simon C » Wed Nov 05, 2008 4:48 pm

correct - if runOnTwo is true, the sync script will go from DB1 -> DB2. If false, it will go from DB2 -> DB1. Changing runOnTwo does the same thing as flipping the synchronization direction in the SQL Compare UI.

Simon C
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 1 guest