Contentful logo

Contentful Community

Issue automating content model changes without overwriting content changes

We have 2 sandbox (dev, stage) environments and master.

Content updates are done on master by marketing team. Content Type (Schema) updates are done on dev by engineering team accompanied by code changes. We do not make any changes that require a migration script. All changes are backward compatible.

We are trying to automate the process of promoting Content Type changes from dev to stage and from stage to master without overwriting the Content changes made by our marketing team. In other words we need a way to keep dev and stage up-to-date with master Content but not Content Type as dev is the source of truth for that.

This seems like it should be a common issue among Contentful users but we could not find a feasible answer in the documentation provided. Have others run into this? How do you manage it?

Hi Madeline,
We solve this problem by using the Migration API. We keep a local version of the content model JSON, and then auto-diff it to the dev Contentful environment. For example, if you added a new field on a type on dev, the code derives a “add field” migration script. This is the “hard part”. After the migration script(s) has been created, you can just check in your migration code together with the production code, and apply the migrations on staging and master environments, as the code moves thru the pipeline. I could add more details, in case this is actually relevant for your question.