An intro to SQL Source Control with SQL Server MVP Steve Jones
Introduction to SQL Source Control
SQL Source Control is an add-in for SQL Server Management Studio that links your database to your source control system.
Because it works with tools you already use, there’s no lengthy setup, yet it gives you the ability to source control schemas and reference data, roll back changes, and maintain the referential integrity of your database.
And it helps you solve other database challenges, like deploying without losing data.
You and your team can work on a shared database or each use a local, dedicated copy.
SQL Source Control supports both models for database development.
Either way, it helps you share code, avoid conflicts, and see who’s doing what, so you can work without treading on each other’s toes.
Exclude objects with filters
If you don't want to share certain objects, such as users or permissions, you can exclude them with filters.
You can exclude objects by type, name, and owner, or specify more complex conditions.
It's simple to share only what you want with your team.
SQL Source Control works with
Team Foundation Server
or any source control system with a command line
How SQL Source Control helps with development and business processes
Deploy your database straight from source control
Avoid errors and stop those 4am deployments
Deploying database changes is nerve-wracking. You have to make certain that nothing breaks and you have to minimize downtime. When something does go wrong, you’re responsible and it can be hard to fix.
So for a lot of us, deployment means queuing up changes, coming in early (or staying late), and crossing our fingers that nothing goes wrong.
SQL Source Control gives you an alternative: deploy from a canonical version of your database in source control. You’re working with a stable version, which cuts the risk of deploying incomplete or incorrect changes.
SQL Compare writes deployment scripts in minutes, making your release safe and efficient. You can deploy from SQL Compare or copy the script to review and run later. You can use SQL Compare to generate rollback scripts too.
With the DLM Automation Suite, you can set up an automated deployment process for your database, using your existing release tool, such as Octopus Deploy.
“I'm anxious to get SQL Source Control up and running as I know the only way to deliver high quality SQL code is by having it under a SCM tool, vigorously testing, (thank you for SQL Test) and being able to confidently and consistently build/deploy the code.
There is so much that Redgate is doing to make Agile Database Development a reality. I'll finally be able to tell my AppDev friends to stow it when they say that database development can't be agile.”
Track progress and pass any audit with a full change history
Keep an eye on database changes and track development progress
Without version control, it’s almost impossible to keep track of development.
What work has your team completed? How did your database reach its current state? Who just broke the build – and how are you going to fix it?
To help you answer these questions, SQL Source Control gives you a full change history for your database and for every object in it.
It shows you who made changes, when they made them, and why. You stay up to date with progress and you get complete oversight of the changes that go into production.
Pass any audit and prove regulatory compliance
A well-documented change management process is also essential to win the trust of auditors or investors.
With a complete record of development changes in SQL Source Control, you can pass audits and prove you comply with standards such as Sarbanes-Oxley or HIPAA.
“If we can prove we can track the entire history of our data’s lifecycle, we’ll pass any audit. If not, we face massive fines, legal charges, suspension from trading, and possible termination of the company. Faced with that, how could I afford not to source control my database? How could anyone?”
Take the first steps in continuous integration for databases
What if you want to do some really clever stuff with your database, like continuous integration?
With your database in version control, you have the basics in place.
A full continuous integration process should build and test everything your project relies on, so SQL Source Control works with our SQL Developer Suite and DLM Automation Suite, to help you test your application and database code side by side.
Using both Suites, you can set up a CI process that updates a test database with your changes (or creates a fresh database from your source files). This keeps application and database development in step and makes sure your project still works when you bring everything together.
Testing your changes up-front means you spot and fix errors early on. Bugs don't have a chance to leave development, let alone make it to production. Your code is shared as soon as it passes the test, so there are no painful merges. Instead, you can build on each other's work as soon as possible.
Our tools for database CI work with the build server you already use and come with plugins for Team Foundation Build and TeamCity, to make setup straightforward.
“Redgate's SQL Source Control gives us the ability to track and document changes, while SQL Compare and SQL Data Compare have enabled us to bring SQL Server to the continuous integration party that the rest of the department depend on.”
How to solve some specific problems for database CI, such as keeping your data safe
How to set up the full process step by step
What our customers are saying
“After using SQL Source Control for several months, I wondered how I got by before.
The ability to instantly keep database structure in synchronization across development, test, and production environments instantly reduced the amount of work and potential for error.
Highly recommended, it has paid for itself several times over.”
“For the price you pay, you'll save the equivalent time on your next version release.”
“Yesterday a vendor made a change to our database which broke some customer extracts.
With SQL Source Control, I was able to find exactly what the problem was and fix it in minutes.”
“Using SQL Source Control has saved Snapper a considerable amount of time (and therefore money) and also led to a higher standard of work.”
“If you assume that each developer saves 15 minutes per day of productivity (that is a conservative estimate), then 1/32 (15 minutes / 8 hours) of their salary is recovered.
If the average developer salary is $80,000, then this by itself translates to a benefit of $2500 per year.
This is just the benefit of not having to maintain and deploy scripts.”
“Liking SQL Source Control is an understatement for something I needed about 12 years ago.”
Our technical partners
Fog Creek Software
The industry standard for SQL Server version control
SQL Source Control - an intro with Steve Jones
Steve Jones, SQL Server MVP and founder of SQL Server Central, explains how to share simple database changes between developers, using Team Foundation Server, SQL Server Management Studio, and Redgate SQL Source Control.
This short guide shows you how to set up and use SQL Source Control with your database and Team Foundation Server, Subversion, or Git, as well as how to get started if you don’t have a source control system.
It covers how to:
Link your database to source control
Make an initial commit
Commit a change
Get a change
Set SQL Source Control options and share them with your team
"SQL Source Control made an immediate impact and saves us hours and hours of time during deployments. We’re now sure we can deploy changes with virtually zero errors." Phil Collins, Head of IT, HospitalityGEM
Find out how HospitalityGEM, a UK-based guest experience management company, resolved the issue of long, unpredictable deployments by introducing SQL Source Control alongside other DLM tools from Redgate.
How SQL Source Control versions your database objects
Database source control is hard because there isn’t any source code. Instead, your queries change the state of the database.
SQL Source Control solves that problem by scripting each database object into a file in your version control system.
It’s possible to do this with an elaborate manual workaround, but SQL Source Control makes it easy for you in three ways:
You don’t need to leave SQL Server Management Studio – you can do it all with a few clicks in the Object Explorer.
You don’t need to remember to script out your files or instil that habit in new team members. SQL Source Control highlights your changes in the Object Explorer, so you see what’s sitting outside source control at a glance.
You don’t have to worry about referential integrity or data persistence. SQL Source Control sorts out the order of your changes and deals with keys and constraints for you. With migration scripts, you can specify how to deal with complex changes that affect your data, such as table splits.
When you’ve made your changes, you check them in with a couple of clicks, just like you would for your application code. SQL Source Control scripts out files that represent the new state of each object and saves them in your version control system.
Not only is it simple to share your work – you also have a history of every change to every object in your database, along with details of who made each change, when, and why.
“Before using SQL Source Control, we'd tried a whole bunch of things. Sometimes we passed around manual backups, or SQL CREATE scripts, but that meant only one developer could work on the database before we had to issue updates again. We tried Database projects in Visual Studio, but they were clunky, and rather fragile when we made substantial changes.
One of our developers eventually cooked-up his own sync tool. It was a time consuming project. We had to teach new developers how to use it, enforce certain conventions, and it only really worked when source and target could be accessed at once, which wasn't often.
SQL Source Control did everything that sync tool could do, without wasting time or causing frustration...Integration with SSMS and TFS saved us a lot of hassle, but the major benefit has been the time it’s saved us making and pushing database changes. I'm not sure I could give that up again.”
One of Redgate’s Database Lifecycle Management tools
Want to improve how your organization develops databases? SQL Source Control gives you database source control, the bedrock of any process improvements. With it, you’ve got everything you need to think about the next step – continuous integration.