CoursesHandling schema changes confidently

Handling schema changes confidently

9
Lessons
Knut Melvær
Knut MelværHead of Developer Community and Education
Certification
Sanity developer certification
Track
Sanity developer essentials

Lessons in this course

Expertly navigate schema changes, validate datasets, and execute content migrations using tools like the Sanity CLI and GROQ queries.


1: Introduction to Schema Change Management

2
Tasks

How to think about schema change management and preparing your project for this course's exercises.


2: Updating the schema to match imported content

8
Tasks

Check document validation status across a whole dataset. Update schema with missing fields for content that's found in the dataset's documents.


3: Changing a field name

2
Tasks

Rename fields by first deprecating existing ones and marking them read only


4: Adapting a front end without downtime

4
Tasks

Prepare a front end for down-time-less content migration by adapting a GROQ query with coalesce()


5: Writing a content migration

7
Tasks

Use Sanity CLI to create a new content migration. Adapt the migration script for your use case.


6: Running a content migration

6
Tasks

Use field validation to validate if the migration was successful. Back up the dataset for safe measure. Run the content migration and verify that it went well.


7: Tidy up the schema and front end code

3
Tasks

Tidy up the document form by hiding the old field. Update your front end to only query and access the new field name.


8: Making the content migration (more) idempotent

2
Tasks

Make it safe(r) to run the content migration multiple times using GROQ filters and idempotency keys.


9: Schema Change Management Quiz