Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Old records still showing on Sanity

Tags:

gatsby

sanity

I have created a Sanity.io CMS, I have made some alterations to the schema after content had already been entered. The problem now is that the content is still saved somewhere inside the cms and I have no way to remove it.

like image 245
Aiden Barrett Avatar asked Dec 14 '22 10:12

Aiden Barrett


1 Answers

There are several ways of deleting documents which are no longer visible in the Studio:

  • Make the Studio render the old documents, either by temporarily putting back the original schema, or defining a list using Structure Builder which will render the old docs
  • Write a script which queries for all documents by that type, and have the script delete them
  • Use the Sanity CLI to query for and later delete the documents, e.g. sanity documents query '*[_type == "unwantedType"]._id' and then sanity documents delete [list-of-unwanted-doc-ids]
like image 173
thomax Avatar answered Jan 27 '23 20:01

thomax