Red Gate forums :: View topic - Using TFS, is there a way to incorporate local/checked out?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control 2
SQL Source Control 2 forum

Using TFS, is there a way to incorporate local/checked out?

Search in SQL Source Control 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
vehro



Joined: 19 Oct 2011
Posts: 6

PostPosted: Fri Dec 02, 2011 7:09 pm    Post subject: Using TFS, is there a way to incorporate local/checked out? Reply with quote

We use a shared db, but using SQL Source Control interacts with the TFS server/db directly and not checked out copies of the code. So, 2nd developer checking in code will overwrite the 1st's if both started working on the same stored procedure before the first check in. I could not get it to work (generating an error/warning). If this could somehow interact with local (on our individual pcs), checked out copy, it could recognize what we'd checked out was stale and prevent the check in.

Maybe I'm missing something obvious?

Thanks.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1114
Location: Twitter: @dtabase

PostPosted: Fri Dec 02, 2011 8:33 pm    Post subject: Reply with quote

Yes, you're right, it interacts with source control directly. We are developing a new tool that integrates into VS, SQL Connect, which might serve your needs better.

http://www.red-gate.com/products/sql-development/sql-connect/

Let us know whether this would work for you.

If you'd prefer to stay in SSMS, an alternative might be to use SQL Source Control but instead of linking to TFS, instead link to a working folder that you link independently to TFS. This will mean that you have to check in to TFS as a separate step.

David Atkinson
Product Manager
Red Gate Software
Back to top
View user's profile Send private message Send e-mail
vehro



Joined: 19 Oct 2011
Posts: 6

PostPosted: Mon Dec 05, 2011 5:29 pm    Post subject: Local source Reply with quote

I do want to stay in SSMS, but dont seem to be able to figure out how to do what you are saying. Do you have instructions for attaching to local checked out source files?
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1114
Location: Twitter: @dtabase

PostPosted: Mon Dec 05, 2011 5:53 pm    Post subject: Reply with quote

I'm not sure if this is something that really makes sense. If Developer A changes Procedure A and Developer B makes a change to Procedure A, then Developer A's change will be overwritten unless he happens to have committed to the working folder first.

A solution to this is to ask your developers to not work on the same objects at the same time. If this is impractical, why not consider moving to the dedicated model, so each developer can make changes without any danger of overwriting others? What is the reason you are sharing a database if you're worred about overwriting each others' changes?
Back to top
View user's profile Send private message Send e-mail
vehro



Joined: 19 Oct 2011
Posts: 6

PostPosted: Mon Dec 05, 2011 8:01 pm    Post subject: Reply with quote

Keep in mind that we are currently evalulating the product, so the concept of dedicated vs shared is still being explored.

We mostly do not work on the same module of code at the same time and as a result >99% of the time it is not an issue.

In the meantime, I would like to explore linking to a working folder, using TFS as our source control, as you indicated:

"If you'd prefer to stay in SSMS, an alternative might be to use SQL Source Control but instead of linking to TFS, instead link to a working folder that you link independently to TFS. This will mean that you have to check in to TFS as a separate step. "
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1114
Location: Twitter: @dtabase

PostPosted: Mon Dec 05, 2011 8:24 pm    Post subject: Reply with quote

In retrospect I'm not sure that this will help as it won't prevent two developers changing the same object on the shared database, so changes could still be lost.

Most SQL developers work on different objects and therefore clashes on a shared model don't happen enough for it to matter. If it's important to avoid these clashes, a dedicated model is recommended as this avoids the issue completely. Unless there's a strong reason why dedicated isn't possible for you, I'd advise you to try this out in the first instance.
Back to top
View user's profile Send private message Send e-mail
sherr



Joined: 19 Mar 2009
Posts: 125
Location: Cambridge

PostPosted: Mon Dec 05, 2011 8:34 pm    Post subject: Dedicated Model / Link to Working Folder Reply with quote

If possible, I would recommend using the dedicated database model. Therefore, each developer would have their own copy of the database and their changes will NOT impact anyone else until the other users explicitly decide to Get Latest. Other users can see exactly what changes have been made before they update their copy.

With or without SQL Source Control, you will always have this problem of overwritting another developer's changes if multiple developers are working against the same db.

In a dedicated model, if 2 developers work on the same object, the first one to commit will have no problems. The second developer will see a conflict when they try to commit. They can decide to take the changes in source control and then they may need to reapply the changes that they made. Or, they can decide to keep their changes and reapply the other devs' changes. (For complex changes, I would recommend using a seperate merge tool to merge the 2 scripts.)

I'd love to hear more about your evaluation and anything that would prevent you from going to a dedicated model.

If you have to work on a shared model, then hopefully this will be rare when it could cause a problem like you say. All users should see blue indicators on the Object Explorer, which indicates changes which have not been committed yet. This is not the same as locking an object so other users can not edit it, but it could be a good warning that someone else currently has edits to that object, so I better wait till they're finished.

Currently, we have not implemented an exclusive checkout feature. You may want to vote comment on this feature request at https://redgate.uservoice.com/forums/39019-sql-source-control/suggestions/802123-tfs-exclusive-checkout-svn-lock?ref=title.


I just had a quick chat w/ David... Unfortunately, linking to a working folder independent of TFS still won't help stop multiple users in the same database from overwriting each others' changes.

_________________
Thank you!
Stephanie M. Herr Smile
Delivery Product Manager


Last edited by sherr on Mon Dec 05, 2011 8:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
vehro



Joined: 19 Oct 2011
Posts: 6

PostPosted: Mon Dec 05, 2011 8:43 pm    Post subject: Reply with quote

It would prevent us from overlaying each others code because the second person would fail in being able to check it in, since what they'd checked out won't match the TFS server, indicating it is out of date.

As I indicated, I'd like to consider dedicated vs shared, but in the meantime, can you please share the instructions for linking to a working folder?

Thank you.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1114
Location: Twitter: @dtabase

PostPosted: Mon Dec 05, 2011 8:46 pm    Post subject: Re: Reply with quote

vehro wrote:
It would prevent us from overlaying each others code because the second person would fail in being able to check it in, since what they'd checked out won't match the TFS server, indicating it is out of date.

As I indicated, I'd like to consider dedicated vs shared, but in the meantime, can you please share the instructions for linking to a working folder?

Thank you.


When this situation occurs, SQL Source Control will flag a Conflict, and the second user has the responsibility to ensure that their changes are merged with the changes in source control before checking in again. There is no chance that the second user will commit to source control and overwrite another's changes by accident.
Back to top
View user's profile Send private message Send e-mail
vehro



Joined: 19 Oct 2011
Posts: 6

PostPosted: Tue Dec 06, 2011 3:25 pm    Post subject: Reply with quote

As I indicated, I'd like to consider dedicated vs shared, but in the meantime, can you please share the instructions for linking to a working folder instead of directly to TFS.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1114
Location: Twitter: @dtabase

PostPosted: Wed Dec 07, 2011 3:35 pm    Post subject: Reply with quote

Follow the instructions here:

http://www.red-gate.com/supportcenter/Content?p=SQL%20Source%20Control&c=SQL_Source_Control/help/2.1/SSC_working_with_config_files.htm&toc=SQL_Source_Control/help/2.1/toc1432725.htm

Essentially you select 'More' in the link dialog. This lets you specify a custom config file. Because we don't provide one for TFS (due to the built-in support) you will have to create your own using tf.exe .

David
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group