Unlock seamless workflows and faster delivery with our latest releases – get the details

Deleting content after accidentally deleting the schema first

5 replies
Last updated: Feb 9, 2021
Hi guys! So, I created a Schema, added content to it, and published. Then I deleted the schema in my code without deleting the content first. How can I delete this data now? I am still getting the data when fetching it
Feb 9, 2021, 2:39 PM
If you know the document ID(s), you could run
sanity documents delete <id>
. If there's a bunch of docs, you could consider putting back a schema with the same name to see things in the studio again, or use a script instead: https://github.com/sanity-io/sanity-recipes/blob/master/snippets/deleteDocsByFilter.js
Feb 9, 2021, 2:50 PM
If you know the document ID(s), you could run
sanity documents delete <id>
. If there's a bunch of docs, you could consider putting back a schema with the same name to see things in the studio again, or use a script instead: https://github.com/sanity-io/sanity-recipes/blob/master/snippets/deleteDocsByFilter.js
Feb 9, 2021, 2:50 PM
awesome! just found these here
Feb 9, 2021, 2:52 PM
tks
Feb 9, 2021, 2:52 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?