nathanwoulfe / Flip

Other
5 stars 0 forks source link

FK error if template not set #3

Closed philipdanielhayton closed 7 months ago

philipdanielhayton commented 1 year ago

Hi Nathan,

Firstly, just want to say thank you so much for this package, it's an absolute god-send. Also, love The Hobbit references.

Anyway, this is something I ran into, it's super easy to get around, and I think it's an issue within Umbraco rather than Flip... BUT just thought I'd raise it just incase anyone else runs into it.

If you attempt to flip to a doc type that doesn't have a default template set, it will throw a foreign key exception.

Microsoft.Data.SqlClient.SqlException (0x80131904): The UPDATE statement conflicted with the FOREIGN KEY constraint 
"FK_umbracoDocumentVersion_cmsTemplate_nodeId". The conflict occurred in database "mydatabase", table "dbo.cmsTemplate", 
column 'nodeId'.

The fix is simple enough; just set a default template. In my case I just created a temporary one that can be deleted once all content is flipped.

nathanwoulfe commented 1 year ago

Hey @philipdanielhayton thanks for the heads-up! I reckon I could manage that entirely in code - create and delete a default template as part of the flippening...

Will see what I can make work.

nathanwoulfe commented 1 year ago

@philipdanielhayton I can't reproduce this - can you share detailed reproduction steps?

What I've tried:

This was on Umbraco 10.