Red Gate SQL Source Control and Plastic SCMWe are happy to announce that it´s possible to work with Red Gate Source Control and Plastic SCM as its source control system. Red Gate Source Control is a tool that makes source controlling/deploying your database easier.
In order to make this integration real we have developed a small XML template that allows the execution of Plastic SCM. You can download the template here (Plastic SCM template). The XML file must be manually added to the following folder: C:\Users\xxx\AppData\Local\Red Gate\SQL Source Control 3\CommandLineHooks, where “xxx” is your user. We are in contact with the Red Gate guys, so hopefully Plastic will be included as a default option inside “Red Gate SourceControl” soon.
You can download a 28-day, fully functional, free trial of Red Gate Source Control 3.1 (Red Gate web page). After installing the program, it gets automatically integrated into your SQL Management Studio.
Main operations example:
In order to show how to use Plastic SCM with Red Gate Source Control we’ll use the Microsoft “AdventureWorks” example database (http://msftdbprodsamples.codeplex.com).
We need to link the database with Red Gate Source Control, it’s easy, right-click on the desired database in the SQL Server Object Explorer and select “Linking Database to Source Control”.
A new window is opened and now we have to choose the Plastic configuration file (remember we manually added a XML template before). As we are going to use Plastic SCM for the database version, we need to create a new Plastic SCM repository for that purpose. Create a new workspace working with the new repository and write the path in the “Working folder” text box.
Finally, by clicking on the “Link” button, our database will be linked to our favorite SCM.
If everything went fine, the database icon will turn green. Now, right-clicking on the database , inside the “Other SQL Source Control Tasks” option you will find the ”Link/Unkink Static Data” feature where it´s possible to configure filter rules and the tables that contains static data you want to keep under version control.
The “Commit all changes view” tab detects database files as “New” and we can decide which one is committed. Then, we write a comment and push the “Commit” button. A new changeset is created in Plastic SCM with the added files.
It is also interesting to show how the “Edit” and “Delete” operations work. For this example, we’ll change a table name and we’ll delete another one. We can see how the program detects the changes and if we finally commit them, again, a new changeset will be created in Plastic SCM.
Using Plastic SCM branch explorer is very useful to have a good vision of our database changes and evolution.
One of the most interesting features is finding the differences between modified files before performing the commit operation.
The figure below shows diffs view. On the right side we can see SQL code generated when we modify a database table.
Once we commit the changes, we can also use the Plastic SCM diff view to check the differences between changesets.
Finally, if we add, delete or edit data from the tables we have linked, when we commit the changes, it´s also very interesting to use Plastic SCM diff view. The image shows the SQL code generated when we modify data in a table.