November Happy Hour will be moved to Thursday December 5th.

Migrating Page,Block and Media-Models to a multisite solution.

Vote:
 

Hello,

Currently at the start of a project where we want to migrate a stand-alone episerver site (source-project) into a multisite solution (target-project). Now the source and the target-project have a contenttype for GenericMedia that has the same ContentType Guid. Im assuming this would be fine, the target project has the same filetypes + some.

We do however have seperate models for Image, Audio, VideoFiles in the source project. In the target project these either map to their own Image- or VideoFile model with a different Content-Type Guid than the source project and in the case of AudioFile it's filetype maps to just the GenericMedia type in the target-project.

Looks like this:

Source-Project:

GenericMedia : MediaData (Guid0, ExtensionString = "pdf,doc,docx,zip,xls,xlsx,ppt,pptx,txt")

AudioFile : MediaData (Guid1, ExtensionString = "mp3")

ImageFile : ImageData (Guid2, ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png")

VideoFile : VideoData (Guid3, ExtensionString = "flv,mp4,webm")

MediaFile : MediaData (Guid4, no ExtensionString)

Target-Project:

GenericMedia : MediaData (Guid0 (same as in source), ExtensionString = "pdf,doc,docx,zip,xls,xlsx,ppt,pptx,txt,crt,geojson,json,kml,eps,mp3")

ImageFile : ImageData (Guid5, ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png,webp")

VideoFile : VideoData (Guid6, ExtensionString = "flv,mp4,webm")

Im thinking that given that the same extensions/filetypes maps to a contenttype with a different GUID in some instances that it could be a problem. Our plan to migrate the data was to use the Export/Import tools under admin once we have migrated all the code. But Im uncertain how we would handle the cases above. Is it possible to change the content-type guid manually in the database so that for example the ContentType Guid of the ImageFile in the source matches the target (assuming props are the same) or would that be hard/potentially lead to problems?

Or what would happen if multiple datatypes has the same Extensions?

Looking for ideas or anyone who has had a similar issue to solve before?

Thanks!

#323415
Jun 11, 2024 14:08
Vote:
 

You can extend the built-in Import process with your custom import logic to handle your use cases. Basically hook into the BlobImporting and ContentImporting events to map the source content to the matching target content type, as described in this blog.

In the case where the source and target types only differ in the content type GUID (i.e. all properties are the same) then it should be sufficient to just update the content type GUID in your custom import handling.

#323454
Edited, Jun 12, 2024 2:17
Vote:
 

Ok, looks like a good approach. I'll look into it and give it a try, thanks!

#323461
Jun 12, 2024 11:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.