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
Upgrading the application dependencies to 4.11.4​
Stop the server before starting the upgrade.
-
Upgrade all of the Strapi packages in
package.json
to4.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.json
file. -
Run the install command:
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/migrations
folder, 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.