Migrating CMS settings after a theme major update
You may need to do a major update of your store theme app due to changes in its peer dependencies, for example. In this situation, however, changing to a new store theme major could lead to undesired consequences, such as losing the admin's page template settings.
To handle this situation, follow the steps below to migrate template settings.
Before you start
- Install the VTEX IO CLI.
- Install the GraphQL IDE by running the following command:
vtex install vtex.admin-graphql-ide@3.x
.
Step by step
- Open the terminal and log in to your account.
- Change to the production workspace containing your latest changes and publish a new major version of your store theme app.
- Create a new production workspace by running the following command:
- Replace the values between curly braces according to your scenario.
vtex use {workspaceName} --production
-
Install the store theme app published in the previous steps:
vtex install {appVendor}.{appName}@{appVersion}
-
Open the VTEX Admin using the workspace created in Step 3 and go to the GraphQL Admin IDE:
vtex browse admin/graphql-ide
- From the Choose an app dropdown list, select
vtex.pages-graphql@2.x
. - Copy the code below and paste it into the GraphQL IDE.
mutation{
updateThemeIds(from:"{appvendor}.{appname}@{oldmajor}.x", to:"{appvendor}.{appname}@{newmajor}.x")
}
- Replace the values between curly braces according to your scenario and press the play button.
- Open the VTEX Admin using the workspace created in the previous steps and validate the CMS's content, routes, pages, and redirects.
- Once you validate your data, promote your workspace to master.