dawoe / OEmbed-Picker-Property-Editor

Property editor for Umbraco CMS to allow embedding 3rd party media like Youtube, Vimeo, ... outside of the rich text editor.
https://our.umbraco.org/projects/backoffice-extensions/oembed-picker-property-editor/
MIT License
10 stars 10 forks source link

Migrating content from v7 to v8??? #9

Closed mistyn8 closed 3 years ago

mistyn8 commented 3 years ago

I've migrated a site from umb 7 to umb 8... (both using the excellent plugin...)

Am I correct in thinking that the migration script isn't knowledgeable about the valueconverter change???

Error converting value "" to type 'Dawoe.OEmbedPickerPropertyEditor.Models.OEmbedItem'. Path '[0]', line 2, position 231.]

Is there a easy SQL script to run to update?

mistyn8 commented 3 years ago

Had a look in the database, so should be fairly straight forward... phew..

v8

textValue : [
  {
    "url": "https://youtu.be/xrl82Ki7yAI",
    "width": 360,
    "height": 240,
    "preview": "<iframe width=\"360\" height=\"203\" src=\"https://www.youtube.com/embed/xrl82Ki7yAI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
  }
]

vs

v7

varcharValue : [
  "<iframe width=\"360\" height=\"203\" src=\"https://www.youtube.com/embed/xrl82Ki7yAI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
]
dawoe commented 3 years ago

Hi @mistyn8

I think Umbraco core has a framework to make this possible that package developers can leverage.

Let me look that up for you.

Dave

dawoe commented 3 years ago

Hi @mistyn8

Core only supports migrating prevalues. https://our.umbraco.com/documentation/getting-started/setup/upgrading/7-8-migration-dataTypes

So I see a fix coming at 2 levels.

Dave

mistyn8 commented 3 years ago

Hi @dawoe Cheers for the response.

luckily I only have 92 items so manual massaging in the db is an option at this stage. :-)

Also does it all become a little convoluted as the requested URL isn't necessarily in the oembed code returned for all providers ?

dawoe commented 3 years ago

Yep the whole issue originated because I already converted this property editor to V8 on the 8.0.0 when there was no migration path. That was introduced in 8.1

So assumed changing the data structure without having any fall backs was a safe thing to do.

If you have the SQL query it would be nice to see that. It can be useful to others.

Dave

mistyn8 commented 3 years ago

This seems to be enough to get it up an running... (caveat being don't use the url/width/height :-)) And prob don't need to alter to the Ntext vs Nvarchar either...

SELECT        TOP (200) id, varcharValue, textValue
FROM            umbracoPropertyData
WHERE        (propertytypeid = 1150)

 update umbracoPropertyData
 set textValue = REPLACE(REPLACE(varcharValue,'[','[{"preview":'), ']', '}]')
 where propertytypeid = 1150 and varcharValue is not null

 update umbracoPropertyData
 set varcharValue = null
 where propertytypeid = 1150 and textValue is not null

Also need to rebuild the databaseCache and inMemoryCache to reflect changes. Also had to increase the database ConnectionTimeOut from 30secs.. as rebuilddbcache on azure took 2.2mins for my site. Also increased the <httpRuntime executionTimeout="900"/> for good measure

mistyn8 commented 3 years ago

Another thought was to leverage MediaNode.GetProperty("OEmbed").GetSourceValue() via UmbracoSurfaceController/UmbracoAuthorisedApiController quick and dirty update??

mistyn8 commented 3 years ago

It's a pity that "packages" area of v8 can't work out nuget installed packages and then we could have a clean up action in the dashboard there?