Jumoo / uSyncMigrations

Rough and ready migration code.
Mozilla Public License 2.0
46 stars 61 forks source link

Propertydata for a mediapicker property became an id string not JSON including mediaKey #241

Open AllanMT opened 11 months ago

AllanMT commented 11 months ago

Our U7.15.10 site used a mediapicker so that a page icon could be selected for each page, and the parent page would show these icons next to each child page in the navigation. Back in late June, the uSync.Migrations --prerelease imported these page icons into U10.6.1 correctly. On 14 November, I downloaded the latest uSync.Migrations --prerelease to show a colleague how I import a v7.15.10 into the latest U10.7.0 but this time (even though we used the same v7 uSync folder from last time) the page icon property didn't show in the back office or public pages. Looking in the umbracoPropertyData database table, the textValue for this property was all like a uniqueid 92992071-a49f-44ec-a6dd-6b06c77cb772, and if we selected the page icon in the backoffice and saved it, the textValue was then of the form [{"key":"ab365a72-4e8a-4152-8794-7b03492c8196","mediaKey":"92992071-a49f-44ec-a6dd-6b06c77cb772"}] like in June, and the icon showed in the backoffice and public pages. I think, but haven't had time to test, that a change to uSync.Migrations since June has changed this. The datatype ended up the same both times: MediaPicker3, and with the same configuration. The workaround for now seemed to be SQL to update the textValue of each page icon propertydata to wrap the original string in JSON so the original string became the mediaKey, and update umbracoDocument to set edited=1 WHERE published=1, and then to publish the home page with descendants. The icons then showed in the backoffice and pages.

AllanMT commented 10 months ago

Another difference the 2nd time was that a datatype that used an UmbracoCheckBoxList with 3 prevalues, worked ok the first time populating the propertydata varcharValue with an array of strings like ["Torbay","Devon","National"] but the 2nd time it populated the varcharValue with Torbay,Devon,National which caused an error in the Umbraco backoffice or on the public pages until I used SQL to change it to be like ["Torbay","Devon","National"], and set the edited flags and publish with descendants as above.

AllanMT commented 10 months ago

Our U10.7.0 has uSync 10.7.1 and uSync.Migrations 4.0.0 from 14th November, and I have found another datatype that used an UmbracoCheckBoxList with prevalues that worked ok last time (the same v7 export imported into U10.5.1 with uSync 10.6.1 and Migrations 4.0.0 22nd June.) but now imports into the umbracoPropertyData varcharValue as comma separated strings which breaks the back office when editing the content. Again using SQL to transform e.g. Male,Female into an array like ["Male","Female"] and then setting the edited flag and then publishing with descendants has worked around the issue so the back office doesn't give an error screen when editing the content.