Avatar of rschmehl
rschmehlFlag for United States of America

asked on 

Team foundations (SSDT) Index generating constraint

I am working with SSDT 2012 and Team Foundations 2012 source control. I have created an index on my dev server and I am attempting to update the Project in TFS.  One issue I ran into is that SS creates a constraint and FK which I did no realize until now. But I am trying to find out in I need to include the constraints in  the check-in or will SS be smart enough to build them when the Prod server is updated.  I'm kinda new to TFS with SQL  Server So any help/ advise would be appreciated.
Microsoft DevelopmentMicrosoft SQL Server

Avatar of undefined
Last Comment
David L. Hansen
Avatar of David L. Hansen
David L. Hansen
Flag of United States of America image

I wouldn't worry about losing the PK or FK constraints in TFS.  Those sorts of constraints are pretty high priority in any database design.  To verify this, upload the project to TFS then pull it down to another computer (if one is available).  At that point you can check to make sure those constraints are in-tact.
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

So you are saying that if I remove them (Exclude them) in the TFS update / checkin that  when the code is generated in Prod they will be rebuild?    
I do not have any way yet to see if what you suggust is true, although I  think it is.
Why exclude them?  I thought you just wanted to store the project in TFS.
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

OK, when I do a Compare ( Dev ss to Project ) and get the differences I go though the list and exclude every thing , then i go bak through and add the index I want.  after that I do an update, which has been showing me things which I did not know where they were coming from.  O, and when I check the index I also check the table to add it.    This may be wrong or I may be missing saomething.
It seems that your question is more of..."do I need those constraints?"  If you want them, then include them explicitly.  If not, then exclude them.  My guess is that the design you've given SSDT requires these constraints even though you didn't expressly add them yourself.  May I ask which tables and fields are getting those constraints?
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

To answer your question, Yes,  When I added the indexes to my dev SS and tested I did not realize constrants were added by SS.   (Just did not think about it )  but yes in TFS at the update level I ADD the Table and Index and TFS  Includes the Constraint  in the create code.  As to your question on which tables it is the one(s) I want to add the new index too.

I'm fairly new to DBA world and especially TFS, as if you couldn't tell.  But yes , do i need the constraints, when i tested the load process in my Dev envorinment I had no issues with data.  Am I missing a key concept or something?
Are you familiar with Primary Key and Foreign Key concepts?
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

yes
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

When I added the Indexes I did not notice the contraints being put on the DB.  So when I went to team to promote the indexes to stage ( which I have not dooe in a while) I noticed the constraints in the code. )
 So I know they are there to preserve referential integraty but my concern is messing up TFS.  do i add the constraint or do I hope TFS is smart enough to create themwhen it promotes the code?
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

Did i say something wrong?
No, not at all.  I'm sorry.  Just keeping up with my day job and had a crazy busy weekend.  Back now and I hope I didn't delay you too much.

So, If we understand how the constraints will work and agree with the system for putting them in, then I'd formally add the constraints yourself.  That way, we won't even need to worry about what TFS will do (it will of course just preserve what you hand it).  You'll just know that those constraints will now be part of your overall design.
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

Thank you, me too,  But I think I'm seeing daylight on this issue   I only added indexes on my dev server and when i compared to the project to do my update I excluded everything and then just added the index and table  Since then i have noticed that someone before me added those constraints. So when iexcluded them it messed me up and now i need to rollback a few items.   but I saw all kinds of stuff in cyber land on this including auto generated constraints,grants .  Im off sick today but i will check tommorow.  I know this may sound confusing to you, as it does to me  So let me just ask one more thing to clarify :   if all i want to do(after testing) is add the indexes I should be able to do this without having to add constraints ????.  similar to adding missing indexes script ?   I truly appreciate your help.  you get all the marbles.  thanks
ASKER CERTIFIED SOLUTION
Avatar of David L. Hansen
David L. Hansen
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of rschmehl
rschmehl
Flag of United States of America image

ASKER

Thank you  appreciate the advise.
Thanks for the points.  Feeling better yet?
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo