Renamed table columns cause build failure?
swinghouse
Posts: 120 Bronze 2
We use your TeamCity plugin (v. 1.0.0.1064) to package our database changes in a TeamCity build project.
This usually works like a charm, but today we ran into trouble and need some help in getting back on track.
The below error message indicates that the problem has to do with a column that we renamed today:
Might I be doing something wrong or is there perhaps a bug in the TeamCity plugin?
/Mattias
This usually works like a charm, but today we ran into trouble and need some help in getting back on track.
The below error message indicates that the problem has to do with a column that we renamed today:
[14:41:36][Generating 0.155 upgrade script] SQL Compare Command Line V10.3.8.406
[14:41:36][Generating 0.155 upgrade script] ==============================================================================
[14:41:36][Generating 0.155 upgrade script] Copyright ¸ Red Gate Software Ltd 1999-2012
[14:41:36][Generating 0.155 upgrade script]
[14:41:37][Generating 0.155 upgrade script] Registering data sources
[14:41:51][Generating 0.155 upgrade script] Creating mappings
[14:41:51][Generating 0.155 upgrade script] Comparing
[14:41:51][Generating 0.155 upgrade script]
[14:41:51][Generating 0.155 upgrade script] Applying Command Line Items
[14:41:51][Generating 0.155 upgrade script]
[14:41:53][Generating 0.155 upgrade script] Retrieving migration scripts
[14:41:53][Generating 0.155 upgrade script] Checking for identical databases
[14:41:54][Generating 0.155 upgrade script] Creating SQL
[14:41:54][Generating 0.155 upgrade script] Inserting static data SQL into deployment script
[14:41:54][Generating 0.155 upgrade script] Saving SQL
[14:41:54][Generating 0.155 upgrade script] Error: Aborting due to High severity warning: Column [IsPEBag] on table
[14:41:54][Generating 0.155 upgrade script] [dbo].[TblBaseLabel] could not be matched to a column in the source table. The
[14:41:54][Generating 0.155 upgrade script] data in this column will be lost.
[14:41:56][Generating 0.155 upgrade script] ##teamcity[buildStatus status='FAILURE' text='Generating 0.155 upgrade script failed with exit code 61']
[14:42:08]sqlCI error occurred: RedGate.SQLCI.Engine.Error: Generating 0.155 upgrade script failed with exit code 61
Might I be doing something wrong or is there perhaps a bug in the TeamCity plugin?
/Mattias
Comments
Also, I do not know the answer to this problem. TC Plugin is beta and undocumented so I will more than likely have to escalate the issue to the development team.
Yes, the issue concerns the TeamCity plugin, sorry if I was a bit vague.
/Mattias
The best work around for this is to use SQL Compare to handle the rename.
If you open SQL Compare and set the source to be either source control and then point at the repository or database (if it is up to date). Then set the target as the database which you are trying to upgrade.
On the Table Mapping tab find the table where you renamed the column, click on the status field for that row and then map up the old and new columns appropriately.
When you are happy with the mappings, click Compare Now on the Edit project dialog.
You will then need to select the changes you want to deploy and click on the Deployment Wizard and follow the instructions. You could just deploy the column rename in this manner.
Because the old column name is included in a package that is currently deployed. You will then need to turn off generate upgrade script in the TeamCity plugin and run a build and deploy the new package to all the environments where you had to update the column name using SQL Compare.
You can then turn on the Generate upgrade script option back on.