Refactoring custom types without data loss?

We need to refactor one of our custom types, renaming field API IDs. It seems this isn't possible without losing data? At the moment our repository is small enough that we can manually transfer the field contents in the editor, but if this need arises again in the future when we have hundreds of documents, this won't be practical.

Are there any solutions I'm missing? Any planned?

Thanks,
Jeremy

Hello Jeremy,

Thanks for posting this question to us.

Yes, It's true that if you change the API ID of the field, you lose the data. You can migrate the data from the old field to the new field using the import-export feature.
You can achieve this by:

  • Exporting the JSON files of your Prismic documents by using the Export module.
  • Make a script to copy data from the old field to the new one in the JSON files.
  • Compress and import the modified JSON files.

Note: the Import/Export feature is only available starting from the Medium plan.

Please let me know if you have any other doubt.

Best,
Priyanka

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.