From cf110b711782252cb395208c8c4bb62835d0e329 Mon Sep 17 00:00:00 2001 From: LR <107395524+VWSCoronaDashboard26@users.noreply.github.com> Date: Mon, 21 Nov 2022 17:54:34 +0100 Subject: [PATCH] bugfix(sanity-keys): added new manual script to delete key & executed Sanity commands to delete rogue key; (#4505) Co-authored-by: VWSCoronaDashboard19 --- 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);