Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Discussion about changing the name field of an object in Sanity.io and the use of a migration script.

4 replies
Last updated: Mar 10, 2023
Does anyone have an example of a migration script to change the
name
field of an object?
Feb 22, 2023, 10:35 PM
This should cover what you’re looking for!
Feb 22, 2023, 11:23 PM
Thanks User I was just looking for this.
Just curious, are there any plans to make this process a little more intuitive?
Mar 9, 2023, 2:24 PM
I forgot to reply to this, but I ended up going with the approach of exporting the dataset, doing a find-and-replace and then importing. This way was really simple.What I was trying to do was change the name of an object which is being used across multiple documents and within arrays, and the migration script approach felt way too complicated.
Mar 9, 2023, 10:12 PM
That does seem easier, I’ll try that! I’m in the same situation where I need to change the name of an object and the script method definitely seems overly complicated.
Mar 10, 2023, 2:09 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?