Roll back in case of a failed deployment

On a failed deployment of the database project, I've observed that the database gets created and the deployment simply stops when the error was encountered. This is not a problem as such. However, is there any setting in visual studio that would cause the entire deployment to be rolled back (i.e. leave the server as it was prior to deployment) in case of any errors?

Even if this feature is not available in the current CTP, are there any plans to include this in the final release?

The error messages show up in the error & output tool panes of visual studio and this is quite useful

-Tanveer Rashid

[1027 byte] By [TanveerRashid] at [2008-2-20]
# 1
Best bet for now would probably be to do a database backup before you deploy changes
SQL-PRO at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 2

For a "new" deployment (which includes creation of the target database), this is easier than deploying to an existing database. One reason: some DDL statements work inside transaction boundaries, others do not. Therefore, a single rollback is not always possible - depending on the schema object types being deployed.

For "new" deployment, we plan to add a project build/deploy property allowing you to choose this specific behavior. If there are errors during a new deploy and we created the database, you will be able to set a project property which specifies whether we:

  1. drop a database we created during the deploy, or
  2. just leave the database (useful for debugging issues)

Deploying to an existing database and rolling back on error is more challenging for the reasons given above. For the TechEd CTP, a good practice (as mentioned in a previous post) is to backup your database prior to deploying so you can restore it.

Thanks for your questions and input. Bruce

BruceJohnson at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...

Visual Studio Team System

Site Classified