2

I just made a number of case only changes (just column names) to a DB under source control and noticed Red Gate SQL Source Control didn't pick them up (no changes to commit).

Will the tool natively identify changes in case? Is it dependent on the collation of the DB? These names are persisting through to an ORM so the case becomes pretty important at compile time.

Update

Just to give a use case scenario, I had a DB under SQL Source Control running under SQL_Latin1_General_CP1_CI_AS collation which is case insensitive, and that's just fine for the DB. I then have a web app using LINQ to SQL classes persisted from the database.

I then decided to change "ID" to "Id" to keep FxCop happy. I've changed it in the database, regenerated the classes and changed any references in the web app. Because I can't get this change under source control, if someone else pulls the database from VCS and regenerates the LINQ to SQL classes, every reference to "Id" is going to break on the .NET side.

1
  • A question with a single, never-before-seen tag is very unlikely to be answered, or even read.
    – skaffman
    Nov 29, 2010 at 11:55

1 Answer 1

1

After spending more time looking at this issue in depth, having Chris from Red Gate unsure of a resolution and not getting any other feedback from this post or the equivalent one in the Red Gate forums, I'm calling this one a bug. I'd love to be proven wrong, but that seems to be the case (sorry about the pun!).

So to specifically answer my question, no, it appears SQL Source Control can't natively version a case-only change. However, there is a workaround involving making the change in the working directory and submitting this back via TortoiseSVN (assuming the VCS is SVN). Th full details are now in Defeating Red Gate’s SQL Source Control insensitivity.

4
  • I'd agree that there's a case for an additional option in the tool to override the database's collation, but it would arguably be strange to have default behavior whereby a case insensitive database is treated as case sensitive simply for the purposes of source control. In practice, the problem would correct itself after you've made a 'meaningful' change to the same object as SQL Source Control would script it out again, this time with your corrections. Dec 1, 2010 at 10:46
  • I think the additional option is the way to go, just as SQL Compare has the "Treat items as case sensitive" option that can be used to sync case across any collation type. But I'd also argue that regardless of how the database handles case in execution is a separate issue to being able to place those objects under source control as they exist in SQL Server. Personally, I don't see that the source control issue should be related to the collation issue.
    – Troy Hunt
    Dec 1, 2010 at 11:45
  • Yes, we're trying to work out whether that option should be on by default.Regarding the source control behaviour, it could be that we decide that the simplest option is to always be case sensitive, which would encourage consistency. We'll keep you posted. Thanks for bringing this to our attention. Dec 1, 2010 at 12:19
  • On the setup tab, it's possible to edit the database comparison options. As of 3.7.7 you can turn on CaseSensitiveObjectDefinition to case sensitively compare object names for a case insensitive database. Other names such as column names will still be compared case insensitively and will require the workaround you found.
    – Graham
    Mar 11, 2015 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.