Skip to main content

v4.6.1+ to v4.7.0 migration guide

The Strapi v4.6.1+ to v4.7.0 migration guide upgrades v4.6.1+ to v4.7.0. We added a data management system to v4.7 that allows transferring data from a Strapi instance to another instance. The data transfer features require generating transfer tokens that use a salt which need to be manually added when you migrate from a previous version of Strapi.

The migration guide consists of:

  • Upgrading the application dependencies
  • Enabling the data transfer feature
  • Reinitializing the application

Upgrading the application dependencies to 4.7.0

☑️ Prerequisites

Stop the server before starting the upgrade.

  1. Upgrade all of the Strapi packages in package.json to 4.7.0:

    package.json

    {
    // ...
    "dependencies": {
    "@strapi/strapi": "4.7.0",
    "@strapi/plugin-users-permissions": "4.7.0",
    "@strapi/plugin-i18n": "4.7.0"
    // ...
    }
    }
  2. Save the edited package.json file.

  3. Run either yarn or npm install to install the new version.

💡 Tip

If the operation doesn't work, try removing your yarn.lock or package-lock.json. If that doesn't help, remove the node_modules folder as well and try again.

Enabling the data transfer features

In order to enable the new data transfer features (remote data transfer, transfer tokens), a transfer token salt needs to be defined in your admin panel configuration file:

  1. Add a new configuration property to your config/admin.(js|ts) file under the path transfer.token.salt with the value being env('TRANSFER_TOKEN_SALT').
  2. Generate a new token salt (string). For instance, you can generate a random string using Node in your terminal by running the following command inside a Node session: crypto.randomBytes(16).toString('base64').
  3. Add the generated token to your environment variables.
/config/admin.js
module.exports = ({ env }) => ({
// ...
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
});

Run the following command in your project root directory to rebuild Strapi's admin panel:

yarn build

Run the following command in your project root directory to restart the application:

yarn develop