Programmatically Link DB to SVN
Reidy
Posts: 6 Bronze 1
Hi
We are currently reviewing the Source Control product as part of an automate developer deployment center.
We would like to be able to programmatically link a DB to source control, rather than relying on the adviser doing this. Is this possible? If so, how?
Thanks
David
We are currently reviewing the Source Control product as part of an automate developer deployment center.
We would like to be able to programmatically link a DB to source control, rather than relying on the adviser doing this. Is this possible? If so, how?
Thanks
David
Comments
Would you mind letting me know though why exactly it is that you wish to do this?
Pete
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569
We are developing a developer dashboard. So, the developer is due to start a new work item. The dashboard would provision the local working envrionment by creating a new branch within SVN for the application code, it would also restore a localised version of the database from a backup.
The intention is to then link the database to SVN so that other developers can then contribute to the same work item.
It would be ideal if we could fire a command line argument into SQL management studio which would essentially say. "Here's a new database, it needs linked to this SVN URL, now automatically commit the initial schema as is".
Thanks
David
In theory this might be possible because we already store the source control repository URL in the database extended property, so it has all the information it needs to do the link. However, automatically linking for all users who have SQL Source Control installed would probably not be the desired outcome, as only 'dev' instances should be linked. However, we might be able to pop up a question to the user when the SQL Source Control screen is loaded and ask the user once if they want to link, and if they accept, the link would happen automatically. Would this more or less be what you're hoping for?
David Atkinson
Product Manager
Red Gate
Product Manager
Redgate Software
Yes it's more or less what we're looking for, the only issue being that in our situation we wouldn't necessarily want to give the user the ability to cancel the procedure.
I did try importing the RedGate dll's into Visual Studio, and found that there appears to be methods available which would create the link... however, didn't manage to get these working.
Thanks
David
The prompt could simply ask the user if they want to enable source control for that database. Confirming this will do the link (turning the database green). The prompt could simply exist permanently on the SQL Source Control screens.
The specific time the user shouldn't be linking is if they select a production database, as linking adds a small amount of load on to the server, which the DBA may not have agreed to. Mind you, this wouldn't be disastrous as the remedy is to simply unlink the database, which is a trivial operation.
David
Product Manager
Redgate Software
While I have your attention, are there any plans to introduce the ability to create custom migration scripts which don't need to be linked to schema changes? So I could say upgrading from v1 to v2 is to simply run an update to data held within a table. (not having this is a major issue to how we would like to use the RedGate Source Control in conjuntion with our internal processes).
Thanks
David
I think the only safe way is to get the user to agree to link. We can make this trivially easy prompting the user when the user tries to perform any source control operation on the database.
Regarding adding migration scripts for non-schema changes, please vote for this here:
http://redgate.uservoice.com/forums/390 ... to-any-dat
The workaround is to add these before or after schema changes, but we are aware that this isn't ideal. Migration scripts at the moment have a from and to revision, which have to be different values. What is required is for us to allow a migration script between two revisions.
David
Product Manager
Redgate Software
I have voted as requested, do you have any idea on expected timescales for this? An alternative we are looking at is making a trivial schema change (such as changing the data type of a column on a dummy table), then using this script for data updates, as you say, this is far from idea.
It would also be nice to name migration scripts manually to make it more relevant.
Thanks
David
Improvements like this will help *all* users get up and running with minimal hassle, and we recognize that this has to be a very positive thing for adoption of our tool!
David
Product Manager
Redgate Software