How can we improve SQL Source Control?

Command line tool (or API) for SQL Source Control Integration

We have an automated system for building our developer environments. It would be nice to have a command line tool that we can use as part of the machine build script to pull down the latest version of the database, build the initial database and link that database back to the TFS source. Our platform consists of quite a large number of databases so linking to them all manually via the UI is a bit tedious.

267 votes
Vote
Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
You have left! (?) (thinking…)
Colin Smith shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

23 comments

Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
Submitting...
  • gvdm commented  ·   ·  Flag as inappropriate

    Nine years and no development for a CLI to be able to link and unlink DBs to source control. Moreover the tool is very slow in checking the DB changes to commit and the fact that we have to perform this action manually and not via a CLI is very tedious and time consuming.

  • Grant commented  ·   ·  Flag as inappropriate

    This would be a very beneficial feature if not almost required. When your trying to source control a large amount of databases over multiple servers then try to have a large team hook into it, its more then a tedious effort for our developers.

  • Alec Joiner commented  ·   ·  Flag as inappropriate

    Aside from even the CI/CD reasons for wanting a command line tool, SQL Server Management Studio and SQL Source Control are two of the slowest products I have ever used in my entire life, and by their powers combined an experience is created that is borderline unusable.

    If comprehensive command line tools existed, instead of SQL Source Control being tied to SQL Management Studio, people would be able to integrate SQL Source Control into whatever tool they see fit.

  • Jon commented  ·   ·  Flag as inappropriate

    I had this comment from Robert Clenshaw from RedGate -

    Although there isn't a native way to relink databases, you might want to look at Alessandro Alpi's blog post on this subject as he's written his own Powershell script to do the job. We can't support this as it's not our code, but if this is a major pain point for you then you might want to consider it. Here's the link - https://suxstellino.wordpress.com/2016/06/28/automatically-link-databases-to-red-gate-sql-source-control/

  • Christian Mills commented  ·   ·  Flag as inappropriate

    I'm just adding my name to this as a great idea. We have a process to create a nightly backup dev environment with relevant tables truncated and shrunk. It'd be great if we could automate adding this database to source control.

  • Anonymous commented  ·   ·  Flag as inappropriate

    I would love be able to use this from other db applications (like http://fishcodelib.com/Database.htm) and an API or command line functionality would allow this to happen. I find using management studio to be so cubersome when all I want to do is make small changes and check in, or just compare changesets quickly.

  • Michael commented  ·   ·  Flag as inappropriate

    I would like to add my vote to the request for this feature - ability to execute "SQL Source Control" commands from the command line for the automation purposes. We manage hundreds of databases and would like all of them to be source controlled. Manually linking, updating and committing would be very tedious. This process should be "automated".

  • AdminDavid Atkinson (Product Manager, Redgate) commented  ·   ·  Flag as inappropriate

    @Nettec - you should be able to do this with SQL Compare's command line, sqlcompare.exe. You just pick the database as the source, and a scripts folder as the target. Then you use the svn command line to commit the changes. Please contact support@red-gate.com if you need more help. Command line switches for sqlcompare.exe: http://www.red-gate.com/supportcenter/Content/SQL_Compare/help/10.0/sc_cl_Switches_in_the_cl

  • Nettec commented  ·   ·  Flag as inappropriate

    I want the shared databases of our team in SVN. Right now I have to click through the UI each day or so. Please help me save time with the ability to automate.

  • Greg K commented  ·   ·  Flag as inappropriate

    If this would be implemented, it would be the final part to automating our nightly builds with database upgrade support. We can use the packager to generate the script but the update from SQL Source Control is a manual process. Please try to get this implemeted - it would be awesome!

  • Joe commented  ·   ·  Flag as inappropriate

    +1 On this feature.

    I currently work on a database-intensive software project. We currently work with 8+ developers on a single development environment, which contains 3 database instances containing 40+ databases in total. There is only one development environment and developers have no local workspace/database instance.

    Manually relinking/updating each of these databases (for example linking to a newly created branch or when you want to bugfix in a previous release) would take too much time if this has to be done manually.

    I know this is not the ideal development setup, but that is not the issue we wish to tackle first.

    I like the appeal of SSMS source control integration and automatic change script generation that other tools lack, but the manual intervention required is just too big a problem to seriously think about SQL SC.

  • Micky commented  ·   ·  Flag as inappropriate

    We would also like a way to automate the commands of SQL Source Control. Specifically, we have this situation.

    1.) Each developer has their own instance of SQL Server with the same 8 databases.
    2.) The developer can use SVN Switch to switch to the branch that they want to work on.
    3.) The developer should be using the schema that goes with that particular branch.

    As it is now, when we switch between branches, we have to go to each of our 8 DBs and do the following:

    A.) Unlink it from where we were working
    B.) Link it to the branch we are working in now
    C.) Get Latest Updates to get things that don't exist but need to exist
    D.) Undo changes to get rid of things that shouldn't exist.

    It'd be great if we could automate A, B, C, and D for each of our 8 DBs. I'm looking into using AutoIT for this, but haven't started that process yet. I'd prefer something more "supported". We could possibly use SQL Compare for some of this, but the feature that we really want is the static data feature of SQL Source Control. That let's us version our lookup tables.

    With the ability to automate this, we'd save a TON of time and prevent mistakes when switching between branches.

  • Kit Eason commented  ·   ·  Flag as inappropriate

    @David That's it in one! Currently we have something home-grown which uses the existing API to create and sync a developer database, would be great if that could also link-to-source-control. On the API versus built-in debate: one could ask why the API exists at all in that case ;-)

  • AdminDavid Atkinson (Product Manager, Redgate) commented  ·   ·  Flag as inappropriate

    @Kit - ideally we'd like to build any automation feature into the product rather than requiring you to automate yourself. Do you envisage that each developer has a way to browse a source control repository, select a version and build and link a database from that version in a single action?

  • Kit Eason commented  ·   ·  Flag as inappropriate

    Lookls like this request has been merged with a separate one I made for an API call to 'Link database to source control'. Note my request was specifically for an API call rather than a command line, though perhaps Red Gate would need to do one to achieve the other.

  • Kit Eason commented  ·   ·  Flag as inappropriate

    With this in place we could create a one-click developer setup, which creates a local database, synchs it with a specified version in source control, and links it to source control.

← Previous 1

Feedback and Knowledge Base