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

Changing a string field to a text field in Sanity.io

8 replies
Last updated: Apr 23, 2020
Hi there! How should I do, having a long long
string
to override the
string
standard container height so that I can see the whole string content.
Apr 23, 2020, 8:39 AM
Hi François! The easiest thing to do in this case is to make it a
text
type field instead where you will have access to the
rows
property to set the number of rows you’d like to show (default: 10). Bear in mind that you’d have to migrate existing content though when making a schema type change.
For more info on the text type:
https://www.sanity.io/docs/text-type
Apr 23, 2020, 8:41 AM
Thanks!I'm going to do that!
Is there a way to migrate existing content easily?
I am learning from scratch, I therefore makes lots of mistakes, if there is one, I'll like to know...
Apr 23, 2020, 9:52 AM
Actually, there shouldn’t be any issues with changing a
string
type field to a
text
type field because the actual data type (still a string) doesn’t change in this case 👍
Apr 23, 2020, 10:11 AM
Thanks!
Apr 23, 2020, 10:12 AM
For other cases, are some tools existing?
Apr 23, 2020, 10:12 AM
Yes, normally you would export, reshape and import your data or, better if you don’t want to interrupt the work of your editors, use a migration script. There’s more information and an example on this page: https://www.sanity.io/docs/migrating-data . There are more examples out there though, so feel free to ask if you ever run into this 🙂
Apr 23, 2020, 10:22 AM
Wah! Thank you☆I'm going to have a look at this.
Have a very good day!
Apr 23, 2020, 10:26 AM
And you too, François! 👍
Apr 23, 2020, 10:36 AM

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?