Reputation: 8042
We're using Contentful CMS, and are interested in programmatically migrating our schema. Contentful has a migration guide available here - https://www.contentful.com/developers/docs/tutorials/cli/scripting-migrations/
The guide describes how to write migration scripts and run them against Contentful to alter its schema. However, it doesn't provide guidance around how the scripts should be run. After a migration is executed, it seems like you have to manually remember to never run it again (if executed again it will produce errors). This makes automating the schema changes difficult. Are there best practices that exist around this?
Upvotes: 1
Views: 905
Reputation: 3879
Heyooo, Contentful DevRel here.
We have a blog post about that.
What it describes is that you could set up a content type that holds the version of the last ran migration. After you ran this migration you could then update then entry and apply some logic.
When you're running bigger migrations you could also have a look at environment aliases which allow you to promote environments to master
after a successful migration. This gives you much flexibility and safety.
Hope that helps. :)
Upvotes: 2