Closed justin-nevitech closed 1 month ago
Hi there @justin-nevitech!
Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.
We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.
Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:
Great I had the same error message. I had also migrated a site from v7 and the constraint had a similar name to yours but with a different hex value on the end. Once I changed the name to the correct one as above, the migration completed and I got a site!
I created different databases for the various stages of migration: v7 to v8, v8 to v10 then v10 to v13.
So I can see those databases and what they contained at the various stages.
I can see that the constraint in the v7 database is called DF__cmsConten__Versi__5C6CB6D7
in my case.
I guess that changing the constraint name in the v7 database before I start the migration again would solve the issue?
The name does not seem to be changed during the migrations apart from the v13 to v13.3, so hopefully this won't stop the other migrations from working and will fix the v10 to v13.3 migration?
That's great you managed to recreate the problem and the same fix worked, that's why I raised the issue mainly so it helped others! I guess you can change the constraint name at any point before migrating to v13.3?
Thanks for this @justin-nevitech! I was having a similar issue in trying to upgrade some sites from v7 to v13, with the error occurring in the upgrade from v10 to v13. Changing the constraint name got everything working for me.
Did the final migration, changed the constraint name in the v7 DB, all OK
Hey y'all this is an interesting one. Did some digging in the code and found the methods that are responsible for creating the SQL commands based on the DTO definitions. From the (unclear) git history it seems like all of this was introduced around version 6. Do any of you know whether these DB's that have the issue were created prior to V7?
Hi @Migaroez No, the version I was upgrading was originally written in V7...
As a possible solution to detect the right constraint to be renamed, could you run the following SQL on the original DB and see if it gives the correct system-named constraint?
SELECT obj_Constraint.NAME AS 'constraintName'
FROM sys.objects obj_table
JOIN sys.objects obj_Constraint
ON obj_table.object_id = obj_Constraint.parent_object_id
JOIN sys.sysconstraints constraints
ON constraints.constid = obj_Constraint.object_id
JOIN sys.columns columns
ON columns.object_id = obj_table.object_id
AND columns.column_id = constraints.colid
WHERE obj_table.NAME = 'cmsContentVersion'
AND columns.NAME = 'versionDate'
AND obj_Constraint.type = 'D'
Hi @Migaroez No, the version I was upgrading was originally written in V7...
Do you happen to know what exact version the initial DB was created in? Not super important if we can get the fix to work, but I like understanding problems 😁
Hi @Migaroez The earliest reference I can find to the initial version is 7.4.3
I've run your SQL and it does return the name of the incorrect constraint.
In 2015 my site was on 7.1.6. The project started in 2014 so may have started on a previous version but probably we stayed with the version we started from. We used Contour for forms. (this made the migration extra complicated since we actually managed to stay with Contour for v7 upgrades!) https://our.umbraco.com/download/releases/716 says it is from 25 Aug 2014 which fits.
Would either of you be up for sending me a v12 or v13.x.priorToWhenTheTroubledMigrationWasIntroduced version of the impacted DB Or test the PR branch on your db when it's ready?
I'd be happy to test the PR branch when it is ready. I don't think I've got a copy of the database on those versions so I would have to migrate again from the V7 version I have.
@justin-nevitech PR is ready for testing
Hi @Migaroez Just tested a migration with your PR branch and it all works fine, thank you!
Before:
After:
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.3.0
Bug summary
Upgrading a site to V13.3.0 throws the following SQL exception on a database that was previously migrated from V7:
Either the parameter @objname is ambiguous or the claimed @objtype (OBJECT) is wrong.
###Specifics
The error is caused by the following SQL statement for the V13.3.0 upgrade in the AlignContentVersionTable function within AlignUpgradedDatabase:
EXEC sp_rename N'DF_cmsContentVersion_VersionDate', N'DF_umbracoContentVersion_versionDate', N'OBJECT'
See here:
https://github.com/umbraco/Umbraco-CMS/blob/b0b2b597403bb381c23ff47f2b1ffc8aeaab1dc0/src/Umbraco.Infrastructure/Migrations/Upgrade/V_13_3_0/AlignUpgradedDatabase.cs#L139
This is assuming the name of the constraint being renamed is DF_cmsContentVersion_VersionDate, but for some reason the name of the constraint in my database was DFumbracoCoVersi__6DCC4D03. Once I manually renamed the constraint to DF_cmsContentVersion_VersionDate the upgrade would continue and run successfully.
The database had recently been upgraded from V7 to V13.2.2 (via V8, V10, v11 and v12) but checking a copy of the V7 database the name of the constraint had been there since V7.
The full stack trace is:
I'm mainly included this here so anyone else that comes across this can find a solution.
Steps to reproduce
I've checked a few other V7 databases and found one other instance where the constraint was named differently, so I don't know at what point that constraint was created or by what. I don't have any other steps to reproduce other than what is already described above.
Expected result / actual result
The upgrade should not fail if it cannot find the constraint being renamed. As the constraint already exists (albeit with the wrong name), this should not cause any problems. If possible, the incorrect constraint name should be detected and renamed.