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.
Thank you everyone for the suggestions and votes for this over the years.
I’d like to surface up a workaround for the “linking” problem which is mentioned in the comments. For the use case of easing pains around environment setup with a large number of databases, we have had customers find success using code based off Alessandro Alpi’s blog post: https://alessandroalpi.blog/2016/06/28/automatically-link-databases-to-red-gate-sql-source-control/
I do understand that this is a broader issue and hear that many of you also want command line or API support for the product in general.
If there are specific scenarios or workflows that would be useful to automate for you, this feedback is also very useful, and if you have details on the type of VCS you use and the workflow (such as a branching model) that it would fit in to, that would be very helpful for us to hear as well.
-
Sam commented
We continue to randomly get errors with database linkage issues. It would be nice if we could get a resolution to this soon as we have hundreds of databases that we have to re-link to source control.
-
Marbry commented
Was this ever added? It was one of the big usability holes for us since everyone would have to manually add 100+ DB's themselves.
If you're shared, have SQL source control installed, I would want the DB to show as under source control in SSMS by default.
-
Christian Mills commented
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.
-
Brett Canter commented
I agree with the comment that a command line enhancement would be an excellent fix. We currently use SQL Compare to generate reports on changes but we automate this reporting using the sqlcompare executable. Something similar for source control would be invaluable
-
Anonymous commented
a command line option to setup linked dbs would be most effencient for our process
-
Brandy Stein commented
would love to have the linking and unlinking portion of databases to have the ability to be scripted.
-
Justin bird commented
As a first step, if extended properties exist but MY copy of SSMS isn't linked, couldn't SourceControl just say "you're not set up, do you want to add this link"?
My entire team have had new machines built recently, we've had to re-connect every database :|
-
Sam commented
Honestly, I don't like the extended properties approach and would rather just see you guys create a Red Gate database that all team members could link up to.
-
Anonymous commented
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.
-
Serge commented
3rd attempting to post this comment...
I've tried the steps below and the users get the linked databases, however they get a "grey" dot on them. When clicking on it they aren't prompted to get a local copy and say "yes", rather they receive an application error:There is no working folder mapping for C:\Documents and Settings\sahar\Local Settings\Application Data\Red Gate\SQL Source Control 3\WorkingBases\y40aughq.j5u.
Which they continue to get each time they click elsewhere in SSMS
-
Serge commented
I tried this route and it appeared to work but the users got a "grey" dot on the green linked database. There was no prompt for them to say "yes" to, rather it generated a SQL Source Control application error:
"There is no working folder mapping for C:\Documents and Settings\<user>\Local Settings\Application Data\Red Gate\SQL Source Control 3\WorkingBases\y40aughq.j5u."
(which they continue to receive while working in SSMS) -
Serge commented
The admin's last post was in April of 2012...It took me hours to set up and link all of the databases from 20 servers to SSC - I can't have 9 other developers doing the same thing. Surely there has to be a solid way of automatically having these developers linked to source control??? Not only do you need to give them the XML file, but you need to create one for each developer...to ensure they have the proper root path Ex: C:\Documents and Settings\doej\Local Settings\Application Data\Red Gate\SQL Source Control 3\Transients\xxx.ddz
I'm on the latest Beta...and from what I can tell there's no GUI options for SSC - does any one know if it's been added?
-
sheldonhull commented
Unfortunately, Chris's solution was not workable for us. I believe this is still a need.
-
John Q Martin (@SQLServerMonkey) commented
I have the same request, we have a large development team and are going to be migrating to use SQL Source Control. We will be using the Shared development model and it would be really useful to not get the developers to link each database on the various servers.
Rather if they can just open management studio and then the Source Control plugin picks up which databases are under source control and sets up the plugin as required.
Many thanks
-
sheldonhull commented
This issue still seems to exist for 2013. Any updates?
-
TM commented
It seems to me there should be a configuration option available to the users to allow RedGate to store the configuration of databases to a specific "RedGateSourceSafeConfigurationDb" database. That way, we could manipulate that table easily to tell RedGate what the linkages are, and RedGate could write to the same table to store the information for new databases/developers.
-
sheldonhull commented
@Chris, why won't the working folders come through, when I see them in the XML file?
-
The reason I ask is that we do have plans to add an auto-link for the shared case, although would you want it to auto-link for everyone, or just pre-populate the repo URL if a user chooses to link it? It's possible to also have something in the dedicated case so long as the extended property is set in the database, and this depends on how the dev DB has been restored/created.
-
Justin bird commented
Hi David, sorry didn't realise there was an update...I don't think it matters? What testing I've done, whether I've selected dedicated or shared it still has the same behaviour. I've considered your question...I can see why you wouldn't want it to auto-link if it's a dedicated database, but if it's shared I think it would be useful to either automatically link (or at least be given the option) to the exisiting repository...
-
@Justin - Are you on the shared database model or dedicated?