From 23feb5bd1e397532ad720baf64daa5ed5b00ef3a Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard19 Date: Fri, 18 Nov 2022 15:50:43 +0100 Subject: [PATCH] bugfix(sanity-keys): added new manual script to delete key & executed Sanity commands to delete rogue key; --- packages/cms/src/migrations/sprint59/index.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 packages/cms/src/migrations/sprint59/index.ts diff --git a/packages/cms/src/migrations/sprint59/index.ts b/packages/cms/src/migrations/sprint59/index.ts new file mode 100644 index 0000000000..1bd48c8429 --- /dev/null +++ b/packages/cms/src/migrations/sprint59/index.ts @@ -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);