Script Verification fails when verified against the shadow database

I am running ReadyRoll on my local and I am able to deploy the solution just fine, which creates the database, schema and all deploy-once, deploy-changes, and post-deployment scripts. However, when I refresh the list of database object changes pending import, it creates a shadow database to verify my scripts against and I receive the following error from a deploy-once script:
Column 'dbo.Images.ImageID' is not the same data type as referencing column 'Locations.ImageId' in foreign key 'FK_Locations_Images'.
Both my Images primary key (ImageID) and my Locations foreign key (ImageId) are of type bigint and work fine when deploying. In fact, the script that is referenced for me to fix, changes the data type on my Locations.ImageId to a bigint so the fk can be created.

Why should this fail when verified against the local shadow db, but not my local db? Any help is appreciated.

Comments

  • So I seem to have found my own issue (after 4 months of having this issue and trying to resolve it intermittently). In case anyone else was similar problems and stumbles upon this, my issue was that I was giving my table a 3 part name in the ALTER ([CloudDb].[dbo].[Locations]). Which is why it deployed as expected to CloudDb on my local, but couldn't make the alterations to [CloudDb_cfrazier_SHADOW]. Names should not include the db. Just [dbo].[Locations]. Thanks!
  • That's great to hear! On a related note, if you do need to use the database name in a script, there's the SqlCmd variable DatabaseName which you can use - this will ensure that the correct database name is used when the script is run.
    Software Engineer
    Redgate Software
  • That's great Chris, thanks for sharing your solution.

    FYI if you'd like ReadyRoll to validate your scripts to make sure that 3-part self-references are not used, try checking this option in the project settings:

    33cbfkfb7dlx.png

    During build, any self-references should then be logged as errors.
    Daniel Nolan
    Product Manager
    Redgate Software
Sign In or Register to comment.