TracksMastering Content OperationsCoursesHandling schema changes confidentlyIntroduction to Schema Change Management
Handling schema changes confidently
Markdown Version

Introduction to Schema Change Management

How to think about schema change management and preparing your project for this course's exercises.
Knut Melvær
Knut MelværHead of Developer Community and Education
Before starting this Course it may be beneficial to have completed:
Log in to mark your progress for each Lesson and Task

Very few content 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, or have come from, the "Day One" course.

This course will build on the same studio, schema, and front end.

If you have not yet already imported the example dataset, it will be easier to complete this course by doing so.

Download production.tar.gz below and import it into your Sanity project by running the following command in your studio folder:

Import the dataset into your project's production dataset
# in apps/studio
pnpm dlx 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.

You have 2 uncompleted tasks in this lesson
0 of 2