How is SQL Change Automation helping you? Share to win DevOps books.

Migration script fails due to column rename

Hello,

My refresh is failing with a March 2018 migration script that is compiling against a table where I have renamed a column.  1. I cloned a new copy of all code down from source control.
2. Ran a refresh to a new db via SQL change automation
3. Ran Redgate Sync V13 to get some db changes moved to my local db SQL automation just created  (this is where the column got renamed)
4. I think I did a refresh to start to create a new migration script for the changes to move back up to our Azure envir. for build and release.

The error occurs on my local instance of the db, below is the reported error.

Thanks,
-Tom
***** EXECUTING MIGRATION "Migrations\0022_20180323-0633_thomas.philbrick.sql", ID: {6a2f0311-5068-47a7-9683-1b054c634aa9} *****
Creating [Submitter].[CreateSubmitter]
Creating [Submitter].[ReadSubmitter]
Msg 207, Level 16, State 1, Server D1710506, Procedure ReadSubmitter, Line 29
Invalid column name 'ApplicationDate'.
Msg 207, Level 16, State 1, Server D1710506, Procedure ReadSubmitter, Line 29
Invalid column name 'ApplicationDate'.
Tagged:

Best Answer

Answers

  • Actually the error occurs during "Script verification failed", says it failed against the shadow database.  When I pulled the code back down from TFS, I had removed the main db and shadow db to initially build all from scratch.
  • Hello Andrea Angella, thank you, I rebuilt the shadow db per the article and was able to continue getting my updates up to TFS.  Thanks! -Tom
  • Opps.  My first migration scripts worked, to alter the tables.  My second migration which just had updated views in it failed with a similar error, looks like it was trying to rerun all the old migration scripts against the altered table that no longer had the fieldname that was renamed?  Here is my log:

    2018-12-13T17:58:11.0912894Z   Validating Deployment Scripts...

    2018-12-13T17:58:11.1347190Z       Ensuring Shadow database is up-to-date

    2018-12-13T17:58:11.1413407Z           Building Shadow deployment script...

    2018-12-13T17:58:11.4837798Z           Deploying Shadow database...

    2018-12-13T17:58:20.2310016Z ##[error]TxSure Solution\TxSureStaging\Migrations\0022_20180323-0633_thomas.philbrick.sql(0,0): Error : An error occurred while attempting to verify project scripts:

    Msg 207, Level 16, State 1, Server TXSUREDEV-SQL01, Procedure ReadSubmitter, Line 29

    Invalid column name 'ApplicationDate'.


Sign In or Register to comment.