What is the best way to migrate the content too, not only the data model? An actual case I am talking about: I have a migration that moves a field from a content type to another, but I would also need that field’s value to be moved, not only the content model.
I have managed to create a node script based on
contentful-migration** that runs all of my migration files, but I wonder what is the best way of handling the content too.
** I use it as
shelljs.exec('contentful-migration ... '. Trying to integrate it as a library generates
TypeError: runMigration is not a function. I would appreciate some help in this direction too.
Have you taken a look at the
With this you should be able to programmatically modify the content of entries inside a given content type. However, if you’re trying to do this outside the realms of a given content type, you’d probably have to write a bit more code extending this tool, making use of context to achieve that.
Also, regarding the error that you received:
TypeError: runMigration is not a function
Could you require the same
runMigration but adding this time around
.default at the end of the require?
Unfortunately, our documentation did not include this and it is the source of this issue. Our team is already aware of it and will update it asap.
Thanks for your answer and sorry for late answer. The idea is that my entries are on 2 different content types. I have like “Category”, “Subcategory” and “Items”. Right now “Items” references “Subcategory” and what I would like to do is to change their “order” like “Subcategory” having reference to “Items”. The idea they are 2 different content types and looks like transformEntries is contentType based.
For moment I will go with
makeRequest and handling all the data through content deliver api until there will be a “migration friendly” option