Document migration

Hi everyone,

We are facing a problem in our application. We are migrating the whole application and thus, creating new document types that are slightly different. The concern is to migrate old types to news types programatically.

We tried a simple export, then changing document json to reflect new structure and import it but it seems that updating the type does not work since the type did not change after the import is done.

So is there a wy to change document type while importing ? What's the best way to operate such kind of document migration ?

Thanks for your answers !

Hello @thomas.meurgey,

Welcome to the Prismic Community, and thanks for reaching out to us.

Could you please share the followings:

  1. The URL of the repo.
  2. The file you are importing.

Thanks,
Priyanka

Hello @thomas.meurgey,

I talked to my colleague and he gave the following recommendations:

You cannot change the custom type structure while you import things. So we recommend:

  1. Test run on a separate environment
  • You should test the whole flow in an environment first, you can instantiate an environment from here: https://your-repo-name.prismic.io/settings/environments/

  • From the isolated environment (no risk to affect production), you can do two things:
    (a) change the custom type definition
    (b) import the content with the new structure

  • Test all this against your corresponding code branch to make sure things are not breaking.

  1. Apply migration in production if this test works properly you will be able to do this operation on your prod repo:
  • Manually update change the JSON structure of the type

Important note: By doing this, there will be no impact on the API responses structure until you publish anything. So you might want to ask your editors to stop publishing while you proceed to the full migration.

  • Import the document data with the new structure. At that stage, you can do an extra test by previewing the Import Release (once the release will be published you won't be able to rollback)
  • Then you can push the code that corresponds to the new content structure and publish the content at the same time.

If you have any questions or concerns, you can connect to our dedicated Solutions Architect @nathanael.

Thanks,
Priyanka

1 Like

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