Contentful Migration is a tool for describing and executing changes to your Contentful content model and transforming entry content. It supports creating, editing, and deleting content types, fields, and tags, as well as performing entry transformations like transformEntries, deriveLinkedEntries, and transformEntriesToType. The current stable version is 5.0.0, which requires Node >=22. It uses semantic versioning and releases frequently. Key differentiators include a declarative migration API, support for both chaining and object notation, and tight integration with the Contentful ecosystem.
npm install contentful-migrationNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a new content type with fields, changing a field control, and transforming entries using a migration function.
Update to Node >=22 and use import/export syntax instead of require().
Use import runMigration from 'contentful-migration' for running, or import { migration } for building migration steps.Access the management client via context.client (provided by contentful-management) rather than using makeRequest.
Ensure the transformEntryForLocale callback returns a Promise (or is declared async).
Do not mark the top-level migration function as async unless you need await inside (which is not recommended).
Use import statements or configure your project to support ESM (e.g., set type: module in package.json).
Use import { migration } from 'contentful-migration' to access the migration builder API.Add return migration; at the end of your migration function.
Ensure the config includes a 'contentType' key set to the ID of the content type to transform.