SQL Compare - Disable Check for Source Drift

jkennedyjkennedy Posts: 18
edited September 9, 2013 4:14PM in SQL Compare Previous Versions
When attempting to deploy using SQL Compare (either creating a script or using SQL Compare) I get an error: "SQL Compare - Aborting" and the failure was in Checking for source drift. Here is the actual error:

A duplicate definition was found for the index PK_[tablename]. Ensure that case sensitivity options are set correctly and all object creation scripts are valid. If the problem persists, contact our support.

The aforementioned table and index are exactly the same on the source and destination that I'm working with. Does anyone know:

1) What exactly is Source Drift checking for?
2) How do I fix the issue?
3) How can I ignore this check?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Source Drift is when the version of the database scripts retrieved from source control doesn't match the version of the database.

    The VCS you use has put the scripts on disk that are one version, and the database says it's a different version.

    The "database" version is kept in a database-level extended property.
    SELECT value FROM fn_listextendedproperty('SQLSourceControl Database Revision', NULL,NULL,NULL,NULL,NULL,NULL)
    

    A few different things could have caused this, like restoring a previous version of the database or reverting some change in the source-controlled version.

    You should have the latest version of the database and the latest version of the scripts. You can make sure you have not restored an older version of the database and/or going into "SQL Source Control" and doing a "get latest" operation. I am assuming you are comparing with "source control" as the source.
  • Thanks for the quick reply Brian. What's wierd is I'm actually performing a database to database compare and still getting this error. I do have SQL Source Control installed on the destination. And when trying to view history on an object, I'm getting a similar error:

    A duplicate definition was found for the index [index name]. Ensure that case sensitivity options are set correctly and all object creation scripts are valid. If the problem persists, contact our support.

    Maybe this is a SQL Source Control issue.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    What happens is SQL Compare sees this extended property in teh database, then it checks it out and tries to compare it to the live database.

    So there is probably a duplicate definition in the source controlled version.

    I think you can avoid it by deleting the extended properties from the database.

    Otherwise check the files out of source control and see where the duplicate definition is.

    The extended properties are called:
    • SQLSourceControl Database Revision
    • SQLSourceControl Scripts Location
    • SQLSourceControl Migration Scripts Location
  • I actually resolved the issue. The problem was that we replaced a view with a table of the same name. SQL Source Control (or SQL Compare) appeared to be validating the new table definition before factoring in the view delete and an exception was thrown. Went in and manually removed the view from TFS and everything worked great.
Sign In or Register to comment.