Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

How to change data type of meta field is already in use?

Vote:
 

I have a meta field declared as a ShortString in an already running Commerce solution. Now it turns out, that the type should have been LongString instead, and I therefore would like to change it from code (I create all Commerce meta fields from code on startup).

I see that the static class MetaField has a Delete and a Create method, but I don't want to remove the existing meta field and it's data from production. I merely want to do a change of the datatype from ShortString -> LongString. Thus I'm missing a method called something like MetaField.ChangeExisting(...).

Can this change of meta data type be done in a running solution?

Alternatively, I will have to create a new field of type LongString, and abandon the old field.

#199022
Edited, Nov 13, 2018 13:17
Vote:
 

No there is no way to do it. I would suggest to add new metafield (even better, new Property) then migrate data from the old one. You can probably write a scheduled job that iterate over the contents then copy the property over. After that you can drop the old property.

#199026
Nov 13, 2018 13:43
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.