v4.7.0 to v4.11.4 migration guide
The Strapi v4.7.0 to v4.11.4 migration guide upgrades v4.7.0 to v4.11.4. We updated how images are fetched in the Media Library, and some people had database records in the wrong state from old migrations. The migration guide consists of:
- Upgrading the application dependencies
- Installing database migration script (Optional)
- Reinitializing the application
Plugins extension that create custom code or modify existing code, will need to be updated and compared to the changes in the repository. Not updating the plugin extensions could break the application.
Upgrading the application dependencies to 4.11.4
Stop the server before starting the upgrade.
Upgrade all of the Strapi packages in
package.jsonto4.11.4:path: package.json{
// ...
"dependencies": {
"@strapi/strapi": "4.11.4",
"@strapi/plugin-users-permissions": "4.11.4",
"@strapi/plugin-i18n": "4.11.4"
// ...
}
}Save the edited
package.jsonfile.Run the install command:
Install the upgraded version:
- yarn
- npm
yarnnpm install💡 TipIf the operation doesn't work, try removing your
yarn.lockorpackage-lock.json. If that doesn't help, remove thenode_modulesfolder as well and try again.
Installing database migration script (Optional)
Skip this step if you can see all images in your Media Library after updating to 4.11.4 or greater.
The issue with missing images in the Media Library is documented here. In version 4.11.4, the Media Library fetches files by their folder path. Root files should have a / path. Some users migrating from older versions had NULL values for root files' folder paths, causing the Media Library to appear empty. This migration updates those files folder paths to /.
To prepare the migration:
- Make a backup of the database in case something unexpected happens.
- In the
./database/migrationsfolder, create a file named2023.06.14T00.00.00.update-file-paths.js. - Copy and paste the following code into the previously created file:
"use strict";
const FILE_TABLE = "files";
async function up(trx) {
// Updates file
await trx
.from(FILE_TABLE)
.whereNull("folder_path")
.update({ folder_path: "/" });
}
async function down() {}
module.exports = { up, down };
- Save the file.
Rebuild the application
Run the following command in your project root directory to rebuild Strapi's admin panel:
- yarn
- npm
yarn build
npm run build
Restart the application
Run the following command in your project root directory to restart the application:
- yarn
- npm
yarn develop
npm run develop