-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Migrations: Use reliable GUID to check for existence of data type when creating (closes #20592) #20604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrations: Use reliable GUID to check for existence of data type when creating (closes #20592) #20604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a migration bug where data type existence checks were incorrectly using integer IDs instead of GUIDs. In Cloud environments with Deploy, restored databases can have different integer IDs for the same data types, causing migrations to incorrectly attempt recreation of existing data types.
Key Changes:
- Replaced
Database.Exists<NodeDto>checks with a new GUID-basedNodeExists()method - Removed unnecessary return value assignments from
Database.Insertcalls
src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_3_0/MigrateMediaTypeLabelProperties.cs
Outdated
Show resolved
Hide resolved
…n creating (#20604) * Use reliable GUID to check for existence of data type in migration. * Retrieve just a single field in existence check.
|
Cherry-picked for |
…n creating (#20604) * Use reliable GUID to check for existence of data type in migration. * Retrieve just a single field in existence check.
Prerequisites
Addresses : #20592
Description
This PR updates the check on whether a data type already exists before creating in a migration to use the GUID rather than the integer ID. In Cloud, with Deploy, there'll be the change of a restored environment creating the data types from the
.udafiles with a different ID than the one we expect when they are created on new installs or migrations - which then causes a bug as per the linked issue when the migration attempts to create them again.I've resolved this by using the GUID which will be the same across all environments and installations.
Testing
You can test the migration by rolling back a current database to an earlier state with the following SQL, such that on start up the migration will run again - this will confirm that the creation is skipped still if the data types already exist.