Zach White
Zach White

Reputation: 179

Is it safe to edit the schema of a blog post in Sanity, after I already have added 4-5 long posts (using the same schema)?

I currently have a blog running on Next.js + Sanity. I have had a lot of success, but in the past when setting it all up encountered a scary error while editing the blog post schema, that basically crashed and caused me to lose my most recent blog post. I assume it had to be an error with trying to change schema of a blog post as it was being written?

Anyway, I now have a few long posts published, and I don't want to lose them. They are in production and getting views, but now I'm realizing I want to add alt tags to all of their images, which I will do via editing the schema.

Is this known as a safe thing to do with Sanity? I can't afford to have these posts go down on me.

Thank you.

Upvotes: 2

Views: 869

Answers (1)

Victoria
Victoria

Reputation: 131

Yes, this is safe to do. If you want to add fields in your schema you won’t run into problems with the existing posts. It’s only when you change the schema type or rename schema fields where you might run into problems. However, these can be solved by exporting your data, reshaping it, and then importing it into your project again. You can find more info about that here: https://www.sanity.io/docs/migrating-data#1-export-c4665bde1f66

Upvotes: 2

Related Questions