From bdf947707fb80e152524e5dd877fb0a80265df10 Mon Sep 17 00:00:00 2001 From: Cesar Varela Date: Tue, 16 Apr 2024 17:20:04 -0300 Subject: [PATCH] Delete dummy translations --- ...4.16T20.04.34.delete-dummy-translations.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 site/gatsby-site/migrations/2024.04.16T20.04.34.delete-dummy-translations.js diff --git a/site/gatsby-site/migrations/2024.04.16T20.04.34.delete-dummy-translations.js b/site/gatsby-site/migrations/2024.04.16T20.04.34.delete-dummy-translations.js new file mode 100644 index 0000000000..3c31d0ba36 --- /dev/null +++ b/site/gatsby-site/migrations/2024.04.16T20.04.34.delete-dummy-translations.js @@ -0,0 +1,24 @@ +const languages = require('../i18n/config.json'); + +/** + * + * @param {{context: {client: import('mongodb').MongoClient}}} context + */ + +exports.up = async ({ context: { client } }) => { + const db = client.db('translations'); + + for (const language of languages) { + const name = `reports_${language.code}`; + + console.log(`Deleting dummy translations from ${name}`); + + const translations = db.collection(name); + + const result = await translations.deleteMany({ + text: /^translated-/, + }); + + console.log(`Deleted ${result.deletedCount} dummy translations for ${language.code}`); + } +};