Introduction to Schema Change Management
How to think about schema change management and preparing your project for this course's exercises.
Very few CMS projects get everything right from the start. Even when you take the time to plan out your content model ahead, there are always “unknown unknowns” that will have implications for how you structure your content and which guidelines and rules you need to apply to your content. It can be character limits that ensure that a specific design doesn’t break; it can be something that you anticipated was a singular thing, actually should be plural, or maybe you came up with a better way to name something.
Having to change your content model, as expressed in a schema, is most often a good thing — it means that you are learning and iterating on your project. Fortunately, Sanity comes with different tools to make it easier to make these changes in a controlled manner and with more confidence, especially when you have to change something running in production.
In this course module, you will learn how to change your schema and content accordingly:
- How to check document and field validation status across a dataset
- How to deprecate parts of your schema
- How to write and run content migrations
- How to write intermediary GROQ queries to support a seamless migration
You should be able to follow this course if you have completed the Day One with Sanity Studio course. It will also build on the same studio, schema, and front end.
To save you from having to fill out and publish a bunch of content to make this course interesting, we have prepared a dataset that you can import and work on.
Download production.tar.gz
below and import it into your Sanity project by running the following command in your studio folder:
production
datasetnpx sanity@latest dataset import ~/path/to/production.tar.gz production
A successful import will give you a bunch of artists, venues, and events in the past and future between 2010–2030.