SQL Source Control 5

Link to a working folder

A working folder contains SQL script files that represent your database. You can source-control the working folder with your source control system, in the same way you source-control other files.

When you link to a working folder, SQL Source Control doesn't automate any source control operations (eg add, push, edit etc). Instead:

  • When you make changes to the database, the changes are listed in the Commit tab. 
  • When you click Save changes, the changes are scripted as SQL files to the working folder. You can then commit the script files manually with your source control client.
  • When you pull with your source control client, the SQL files in your working folder are changed, and the changes are listed in the Get latest tab. 
  • When you click Apply changes, the changes are applied to your database.

If you want to do atomic commits of your database schema together with your application code, you can do this by linking to a working folder. For more information, see Example - source-controlling database schema and application code together using a working folder.

To link to a working folder

  1. Create an empty folder in your source control repository. This will be the working folder you link to.
  2. In Management Studio, in the Object Explorer, select the database you want to link to source control.
  3. In SQL Source Control, on the Setup tab, select Link to a working folder and click Next:

    The Link Database to Source Control dialog box opens.

  4. Enter the location of the working folder.

  5. If you're linking to a database that will be used by multiple developers, make sure Shared database is selected. For more information, see SQL Source Control for teams

  6. Click Link.
    The database is linked to source control. The database icon in the Object Explorer changes to show that the database is linked:

If you're the first person to link this database, add the database objects to source control. To do this, go to the Commit tab and save the objects to the script folder, then commit the SQL file changes using your source control client.

If you linked a database that's already in source control, update your database to the latest version. To do this, get the latest changes to the script folder using your source control client, then go to the Get latest tab and apply the changes to the database.


Didn't find what you were looking for?