Posted on 18/11/2022 23:50:11
Good timing since we just ran into this same issue. After looking into it, I see that the primary key name on our site didn't line up with the update script, causing it to fail.
It's from update 2235, 3/16/22. Here's the command:
ALTER TABLE [EcomCustomerFavoriteProducts] DROP CONSTRAINT [DW_PK_EcomCustomerFavoriteProducts];
ALTER TABLE [EcomCustomerFavoriteProducts] ADD CONSTRAINT [DW_PK_EcomCustomerFavoriteProducts] PRIMARY KEY NONCLUSTERED (
[FavoriteListId] ASC,
[ProductId] ASC,
[ProductVariantId] ASC
);
ALTER TABLE [EcomCustomerFavoriteProducts] ALTER COLUMN [ProductLanguageId] [nvarchar](50) NULL;
For us, the issue was that our primary key was named PK__EcomCustomerFavo__743A1EC7. That's our dev instance. In production, it's PK__EcomCust__E84A6639C694A42A. I checked a couple other databases and they are correctly set to DW_PK_EcomCustomerFavoriteProducts. I bet there's some legacy consideration going on.
To fix it, I found the name of the primary key on the EcomCustomerFavoriteProducts table and manually ran the script. For example:
ALTER TABLE [EcomCustomerFavoriteProducts] DROP CONSTRAINT [PK__EcomCust__E84A6639C694A42A];
ALTER TABLE [EcomCustomerFavoriteProducts] ADD CONSTRAINT [DW_PK_EcomCustomerFavoriteProducts] PRIMARY KEY NONCLUSTERED (
[FavoriteListId] ASC,
[ProductId] ASC,
[ProductVariantId] ASC
);
ALTER TABLE [EcomCustomerFavoriteProducts] ALTER COLUMN [ProductLanguageId] [nvarchar](50) NULL;
Running that manually updated the database to the expected settings.
Thanks,
Scott