cms12 database upgrade failed

Vote:
 

I setup a local db from a copy from PROD.
In Visual Studio, I setup an Optimizely CMS empty project and set the "EPiServerDB" connection string to this local db.
When running the site I get an error ‘Failed to update database’.

This is the only package in the Project:
<PackageReference Include="EPiServer.CMS" Version="12.26.0" />

Where can I look to see why the db upgrade is failing?

#314177
Dec 14, 2023 14:25
Vote:
 

Maybe you can add this to your Startup.Configure ?

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

#314178
Dec 14, 2023 15:04
Vote:
 

I set the LogLevel to Trace for everything and in the Output window I see it trying to apply all of the update scripts.
However, it's trying to do this in 12.8.0.sql

ALTER TABLE [dbo].[tblMappedIdentity]
    ADD [Metadata] NVARCHAR (MAX) NULL,
        [Saved]    DATETIME       NULL;

but my cms11 database already looks like this...



the error:

System.Data.DataException: Failed to update database during execution of statement 'ALTER TABLE [dbo].[tblMappedIdentity]
    ADD [Metadata] NVARCHAR (MAX) NULL,
        [Saved]    DATETIME       NULL;
'
 ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Column names in each table must be unique. Column name 'Metadata' in table 'dbo.tblMappedIdentity' is specified more than once.
   
#314180
Dec 14, 2023 15:09
Vote:
 

I see, it is possible to just drop the two columns and proceed - especially as this is for local development it should not have any consequences.

I will look into this to see if we can do anything about it 

#314181
Dec 14, 2023 16:27
Vote:
 

I tried your suggestion and removed the two columns. The db upgrade script now gets to 12.8.0.sql and errors trying to create a stored proc.

Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'netMappedIdentitySetMetadata' in the database.
#314183
Dec 14, 2023 18:36
Vote:
 

I deleted the stored proc 'netMappedIdentitySetMetadata' and now the db updates finish without an error.

#314184
Dec 14, 2023 19:16
Vote:
 

Public Bug posted: https://world.optimizely.com/support/bug-list/bug/CMS-31381

#315875
Jan 19, 2024 19:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.