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
Stop the server before starting the upgrade.
Upgrade all of the Strapi packages in
package.json
to4.7.0
:package.json
{
// ...
"dependencies": {
"@strapi/strapi": "4.7.0",
"@strapi/plugin-users-permissions": "4.7.0",
"@strapi/plugin-i18n": "4.7.0"
// ...
}
}Save the edited
package.json
file.Run either
yarn
ornpm install
to install the new version.
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:
- Add a new configuration property to your
config/admin.(js|ts)
file under the pathtransfer.token.salt
with the value beingenv('TRANSFER_TOKEN_SALT')
. - Generate a new token salt, which is a string. For instance, you can generate a random string using Node in your terminal: Run
node
to enter the Node REPL and run the following commandcrypto.randomBytes(16).toString('base64')
, then copy the generated random string (without the single quotes), and finally press Ctrl-C twice to quit the Node REPL. - Add the generated token to your environment variables.
- JavaScript
- TypeScript
module.exports = ({ env }) => ({
// ...
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
});
export default ({ env }) => ({
// ...
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
});
Run the following command in your project root directory to rebuild Strapi's admin panel:
- yarn
- npm
yarn build
npm run build
Run the following command in your project root directory to restart the application:
- yarn
- npm
yarn develop
npm run develop