Friday, May 13, 2016

Check In Database Scripts in to Team Foundation Server (Using VS 2015)

After TFS server is ready with folders created for databases, you need to take database scripts in your own style and check in to TFS. This is one of the database version control methods.
 Install Visual Studio 2015 and once you launch you need to click on Team (5th tab from left) button of Visual Studio main page. Select Connect to team foundation server to make a connection to TFS server for the first time or click Manage Connections if it is already configured.

Below is the structure created in my Team Foundation Server:


To upload database scripts to these folders you have to create similar structure in your local drive as below screenshot shows


Create subfolder as Databases in SQL folder and one folder for each database again. Create 3 subfolders in each database similar to the TFS structure for example Dev, Integration and Main. It is explained in the below screenshot.


Again under each environment I have created folders for each database objects separately.
Take scripts separately and check in using below instructions.
When you highlight the folder left side you will see the location of the folder you created locally as Local Path.


After taking database scripts, copy those in their respective folder in your local drive.
To check In those scripts, right click on the middle panel and click Add Items to Folder option.


If you already add scripts to your local folder you will see the script file to add like below.


Highlight the script file and click next or finish to check in. You will see the added file like below


Right click on the file and click check in pending changes option. It will complete the check in process in to TFS.
Best Practice would be to always Right click each branch and click on the ‘Get Latest Version’ as shown below and then right click on the Sub-Folder and click on ‘Add Items to Folder’ option, select the scripts and click on ‘Finish’ button’…In the Solutions Explorer highlight each script, hit the F4 button and make sure the Build Action is set to ‘None’….then right click on the project and click on ‘Check In Pending Changes’ option and click on the ‘Check In’ button.

1 comment: