5

I'm looking for open source SQL Server database version control addon/tools to link with Git.

I tried gitSQL and red-gate sql source control (not an open source). With gitSQL I see a problem that when I try to export an object it seems to export dependencies as well.

I would like to get some recommendations for good tools for SQL Server version control.

I am using SQL Server Management Studio 2014.

2

enter image description here

Plain text files, in Git/Mercurial

Use your source code version control such as Git, as you mentioned, or Mercurial.

Track the creation, definition, and evolving changes as SQL scripts. These are plain text files, and can be kept along with your app project or in a separate project of their own.

As these are just text files, you do not need any special add-ons or tools to link with Git.

You may want to use a database migration tool to help manage and automate the chore of running each of these scripts in a certain order as needed. You execute a migration when re-creating a database, or to update a database already in use.

Flyway

The Flyway project is a database migration tool. Every step you take in evolving your database structure is recorded as a SQL script to be managed by Flyway. When Flyway encounters an instance of your database that has not yet been brought up to date, it runs the applicable SQL scripts.

You can keep those SQL scripts along with your source code, including as part of your version control system. Or you can keep those scripts external to your project, and then point Flyway to them at runtime.

Optionally you can apply Java classes in addition to the SQL scripts to effect changes to your database, for complicated situations where SQL is insufficient.

Flyway is built on Java, but useful for non-Java developers as well, with command-line utility wrappers around the invoking Java classes. So you can run Flyway from a console, a shell script, or from your build/integration server.

Flyway is open-source, free-of-cost, and rapidly growing in popularity.

Supports Microsoft SQL Server and a couple dozen others such as Postgres, H2, DB2, and so on.

Quite helpful for testing as you can create a fresh new empty database and then have Flyway bring that DB up to any desired point in your development history.

Liquibase

Liquibase is quite similar to Flyway in its purpose, but your migrations are driven by XML scripts rather than SQL scripts.

You should consider and compare Liquibase while considering Flyway. They are both strong successful tools.

  • thanks for your comment. I'm looking for version control tools not migration tools. Flyway and Liquibase are migration tools. Please could you advise any open source version control tools for SQL server? – learntocode Jul 3 '17 at 10:44
  • 2
    @bhuvana You put the SQL scripts managed by Flyway into any regular version control system such as Mercurial or Git. Now you have a complete history of the evolution of your database structure. What else could you mean by a “version control tool for SQL Server”? Edit your Question to explain exactly what you need. – Basil Bourque Jul 3 '17 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.