Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

bugfix/delete-undefined-sanity-key #4505

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/cms/src/migrations/sprint59/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* THIS SCRIPT DELETES DATA!
*
* To use this script:
* 1. Run `sanity dataset export` to backup your dataset before deleting a bunch of documents
* 2. Run `sanity exec src/migrations/sprint59 --with-user-token` to delete the documents
*
* NOTE: For the time being you should not delete more than ~1000 documents in one transaction. This will change in the future.
* See docs:https://www.sanity.io/docs/http-api/http-mutations#deleting-multiple-documents-by-query
*/

import { getClient } from '../../client';
const client = getClient('development');

client
.delete({
query: `*[_type == "lokalizeText" && [_id] match "c39981a1-bfa4-4aec-bf65-f0143820e150"]`,
})
.then(console.log)
.catch(console.error);