-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to migrate short text list of items to new content type and reference it to source #158
Comments
Hey @GuyLivni, This is not straightforward with the migration but achievable. First, you need to change the list field to a reference field that holds all the content. using Second, you use Please let me know if you have questions |
@Khaledgarbaya can you elaborate a bit more here? I've got the same issue but am not fully understanding your question. Building on @GuyLivni's example, how should change the list field to a reference field that holds the content, would this be a new intermediate content type? Here is an illustrative example,
When I run a similar migration I get the following error with using 0.26.4 of Contentful CLI migration. ✖ Making requests (1/1048) Stacktrace points too: |
the code will look something like this
this script will copy all the values from an ordinary list field to a reference field with a list field
|
Hey @Khaledgarbaya, thanks for the help here! I'm not sure I explained myself correctly. I don't see how the two snippets above would convert an array of strings into an array of objects. I've tried adapting your example to my use case but I am unable to access 'list' in the second snippet because it is a field on another content type - and all we get to access from the migration are links to the content, not the content itself. Product might have been a bad example above, let me try with another example: Tags. Let's say I have a list of symbol (string) field called 'tags' on a 'Product' content type. Now instead of an array of string I want to convert tags to its own content type 'Tag' with one field 'tag_text'. So now Product will have a reference list field which contains many Tag content type objects, each with one field holding the tag_text (the original string). So, in essence, I am converting an array of strings to an array of objects. It is the same as converting a single text field to a single content type reference but just many to many (which is what I would expect this example to portray: https://github.com/contentful/contentful-migration/blob/master/examples/20-derive-entry-n-to-n.js). This may require potentially just scripting this manually with the Content Management API. |
Has there been any changes made for this? I am running into this exact use case as well, and would prefer to not have to manually migrate over the fields. |
This ticket has been closed due to inactivity. If you still need help resolving your issue, please reach out through our community Slack, or contact Contentful support directly. |
Does someone actually got this to work? |
Expected Behavior
When migrating a field which is a List of items
I want to migrate each item to new entry
so that I can then reference each new entry item as a reference field in the source
Actual Behavior
Currently it is impossible to migrate a field using deriveLinkedEntries API, if the field is a "short text" list of items, and I want to create new entry for each item and then reference the items back to the source.
Example
from:
to:
Possible Solution
Allow deriveLinkedEntries to create multiple entries from short list and reference it back.
Steps to Reproduce
Context
The migration can only be done manually, by copying each field content.
Environment
The text was updated successfully, but these errors were encountered: