Introduction
We’ve all been there. We’re finishing up a database project, feeling good about life, when suddenly we realize something’s seriously wrong with the stored procedure we deployed to production. Or worse, the boss finds out first. A mistake like this could cost us our job, our reputation, maybe even our sanity. What do we do?
In the past, our options were limited. We could try to fix the mistake in production, which was risky and difficult, especially under pressure. Or we could try to restore from backup, but that would take forever and meanwhile all eyes were on us. How embarrassing. But now, thanks to the new undo feature in VersionSQL 2.0, we have a third option: We can simply undo our mistakes and pretend they never happened! 😉
In this blog post, I’ll give you a quick overview of how the undo script generator works and how to use it. So let’s get started!
Where does the undo script come from? Is it magic?
Kind of! It’s version control.
Developers have been using version control for decades to save revisions of their code. In the same way, DBAs and database developers can use version control to save revisions of their database schemas.
By connecting your database to version control with VersionSQL, you can save a history of changes then revert back to previously saved versions when needed.
Tell me more about this “reverting” you speak of.
If you have ever used version control with files before, then you are probably familiar with the concept of reverting changes. It winds back the clock; puts things as they were.
VersionSQL’s undo feature is just like that, except it works on databases instead of file systems.
What hoops do I have to jump through?
To use the undo script generator:
- Right-click on the object you want to revert in SSMS’ Object Explorer and select “Undo”
- Pick a reversion from the history window that appears
- Review the generated script and run it on your database
Easy, right?
Is this just for stored procedures?
This feature is available for all the database schema objects VersionSQL supports: tables, views, stored procedures, functions, etc.
Whether you need to undo a change that was made accidentally or you want to experiment with different versions of an object, VersionSQL 2.0 has you covered.
Is this for me?
If you work with databases at all, the undo script generator is an essential tool that will save you time and frustration. Give it a shot: Download the VersionSQL 2.0 Preview
Thanks for reading! I bet you can tell some great stories about times when you could have used an “undo” function like this in SSMS – I want to read them: [email protected]
— Michael (Founder & Developer)
P.S. The full release of VersionSQL 2.0 is getting closer! Deployment scripts, dark mode, and more are just around the corner…