Reputation: 956
I've seen different proprietary tools available which provide source for SQL Server, and while I've researched somewhat, I don't understand how these tools work. My concern is as follows:
Suppose I have source control for a c# project. Step #1: I make local changes in Visual Studio, and then step #2: I commit changes. At that point, the changes are pushed to the repository, let's say svn.
Before step 2, where are the changes? The answer is, they're on my local machine. They're a bunch of .cs or other files.
So my questions is, with SQL source control, what actually happens before I commit? I don't have a local copy of the database. Without source control, my SSMS client pushes the changes directly to the server. I don't see how it's possible to have the first step in a SQL environment.
Upvotes: 0
Views: 140
Reputation: 48402
It works the same with SQL source control. I use SSDT (SQL Server Data Tools) for source control. There are a number of ways you can work with this. But once you have the schema in SSDT, you can make changes directly in SSDT and then synch them to your Developer, QA or Production SQL Server.
When you make a change to the schema in SSDT, you are actually making changes to SQL script files in source control. You can then check them in and deploy, much like a C# project. You can also 'build' the project which validates the integrity of your DB. It's all very slick, works well and SSDT is 100% free.
Note: When working with SSDT, you are not actually developing against any of your databases. All changes are made to SQL script files. It's not until you deploy changes to one of your SQL servers is any physical schema modified.
Upvotes: 3
Reputation: 41
Visual Studio allows you to create database projects which create a model of the entire database schema on your local machine, which can be source controlled. VS can publish changes by performing a schema comparison between your model and a given target database and then generating the necessary commands to make the target match your model (hopefully without dropping all the data).
So if I was writing an application with a C# component and a SQL component I'd have both projects in the same solution to keep changes in sync.
Upvotes: 1