Jumoo / uSyncMigrations

Rough and ready migration code.
Mozilla Public License 2.0
44 stars 58 forks source link

Migrating a property into two properties? #127

Open enkelmedia opened 1 year ago

enkelmedia commented 1 year ago

Hi!

I'm migrating a site where they've used a "Date Range Picker" (Diplo.DateRangePicker). I'm not sure if there is a good alternative for Umbraco 11 but in this scenario it would work for me with just having two date pickers. To the current property "dateRange" would need to be translated into "startDate" and "endDate".

I've been playing around but not really managed to get this to work. Would you say that this could be done and if yes, any pointers? =D

KevinJump commented 1 year ago

Yes it is possible.

We added the concept of a ISplitPropertyMigrator - recently (ht @michaelchart )

which is how the migrator for the EpiphanySEOMetaddata property is now working : https://github.com/Jumoo/uSyncMigrations/blob/main/uSync.Migrations/Migrators/Community/EpiphanySeoMetadataToSeparateFields.cs

this gives you the option to define some split properties. which migrations will then create on the content type and move the properties from the source into the target.

so i suspect you could define the startDate, endDate properties and get the method to split it up.