Fix 'Yet Another Media Picker 4' For Upgrade From Umbraco 4.0.x to 4.5.2

Umbraco Developer Tutorial

Recently we upgraded an Umbraco 4.0.3 website to Umbraco 4.5.2 and found that the 'Yet Another Media Picker 4' package isn't supported in 4.5.2. Unfortunately, simply selecting Media Picker as the new type isn't going to work because the YAMP4 stored its media id in the NText field in the database instead of as an Integer.  Yikes!  Database deep dive...here we go!

Luckily, I found a thread from our.umbraco.org where Matt Brailsford and Nik Wahlberg work this issue out for the most part: Media Picker w/ Preview after upgrade

When I got into the thread, it was a bit confusing and it was actually referring to a different package so I thought I'd blog my experience with the conversion process and YAMP here.

1. Backup your database

2. Find the content page properties that have used the YAMP4 to store media and review to make sure it looks good.

SELECT pd.* FROM cmsPropertyData as pd inner join cmsPropertyType as pt on pt.id = pd.propertytypeid inner join umbracoNode as n on n.id = pt.dataTypeId WHERE n.uniqueID = '9C6A12A7-C7E3-4515-B0E3-5D63B402063E'

3. Copy and cast the dataNtext field to dataInt for those records.  Thanks to Nik for the process on this one.

(BTW, you backed up your database, right?)

UPDATE cmsPropertyData SET dataInt=CAST(CONVERT(varchar(20),dataNtext) AS INT) FROM cmsPropertyData as pd inner join cmsPropertyType as pt on pt.id = pd.propertytypeid inner join umbracoNode as n on n.id = pt.dataTypeId WHERE n.uniqueID = '9C6A12A7-C7E3-4515-B0E3-5D63B402063E'

4. Clear the dataNtext field

UPDATE cmsPropertyData SET dataNtext = null FROM cmsPropertyData as pd inner join cmsPropertyType as pt on pt.id = pd.propertytypeid inner join umbracoNode as n on n.id = pt.dataTypeId WHERE n.uniqueID = '9C6A12A7-C7E3-4515-B0E3-5D63B402063E'

5. Change the 'Yet Another Media Picker' Data Type in the Developer section to use the 'Media Picker' as its rendering control.

6. Test your Content pages with images on them and verify everything is working.

You're done!

Author

Jason Prothero

Jason leads the team at ProWorks Corporation, an Umbraco Platinum Partner specializing in complex Umbraco CMS builds, integrations, support, and upgrades. With 17+ years of Umbraco experience and an Umbraco MVP, he has led dozens of successful projects from versions as old as Umbraco 4 to the latest Long-Term Supported (LTS) releases. Jason is also leading the charge at ProWorks around AI and how to responsibly integrate AI into Umbraco and websites to create ROI and not simply as a novelty.

comments powered by Disqus
back to top