Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Database Project Rollback Script

I'm using the Database project in visual studio 2010 to generate a script to deploy my database (and it's changes). This works great.

Is there a way to have Visual Studio database project generate a rollback script as well as the deployment script.

I'm not looking for rolling back the transaction while deploying; but say I deploy it and my stored procedure has an overlooked performance issue that comes up a week later that requires a rollback to the previous version of the database.

Is there a way to generate the rollback script at build/deploy time that will undo whatever changes the deployment script made.

EDIT: If we ignore that I'm using a database project: What is a good way to have an upgrade and downgrade path for a database generated?
This generation needs to be part of an automated build process.

like image 864
QuinnG Avatar asked Feb 28 '11 22:02

QuinnG


1 Answers

To create a rollback script While doing a schema compare using VS2010, It is as simple as swapping the db names specified in the source and target.

This way VS2010 would create a rollback script which would have drop statements against your stored proc.

like image 70
Ankur Mongia Avatar answered Oct 19 '22 09:10

Ankur Mongia