tags:

views:

48

answers:

2

Hi,

Can we use GIT as the source control for sql management studio?

A: 

There have been a number of answers around this question which you might want to look at but in a nutshell ....

The nature of version control is to store the original file and then the deltas, the difference between the original file committed and and subsequent changes (ok i have made that a bit simpler than it is perhaps) and then to manage the version number and give tools to extract any particular revision you need. This also then allows you to compare previous revisions and roll back (etc. etc.)

The RDBMS is made up of the schema and the and data these change and can change frequently in the case of the data so even if you did VCS what would you compare to do a restore and how would that help? Assuming you have a live system then reverting to an earlier revision would lose all the data stored in the interim and although i have never tried it i suspect could destroy the general integrity of the RDBMS.

The better solution is to use a backup application built for that RDBMS, MySQLdump say in the case of MySQL which makes a snapshot of the data and the structure of the data and store that in a safe place.

Dumps can be scheduled regularly and you can do things like master/slave databases (or other strategies) so you can backup live production databases on the fly without impacting on performance

PurplePilot
I believe the OP is asking about source control for DDL and scripts, not how to backup a complete database.
Pondlife
Yes looks like it my apologies, so he is asking how to source control an application?
PurplePilot
A: 

Since SSMS is (more or less) a custom version of Visual Studio, you might be able to use a solution intended for VS:

http://stackoverflow.com/questions/507343/using-git-with-visual-studio

Alternatively, manage your DB source code in Visual Studio from the beginning, not in SSMS. That way (at least in VS2010) you have database projects, integrated deployment and unit testing etc. Or continue using SSMS and check in your code from an external tool when you're ready (not so convenient, of course).

But it depends on exactly what you're doing: SSMS is a DBA tool, VS is a developer tool. Either way, you should be using some form of source control, but it's not clear from the question exactly what sort of files you need to version.

Pondlife