From 268b8dc33babd206a518da04d0b0c31c5e793da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arwid=20Thornstr=C3=B6m?= Date: Fri, 27 Jun 2025 10:14:52 +0200 Subject: [PATCH] delete producttitles and report back (#487) * delete producttitles and report back * move file to correct migration number --- migrations/000.561.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 migrations/000.561.sql diff --git a/migrations/000.561.sql b/migrations/000.561.sql new file mode 100644 index 0000000..4770908 --- /dev/null +++ b/migrations/000.561.sql @@ -0,0 +1,16 @@ +WITH deleted_textids AS ( + SELECT textid FROM "i18n-texts" WHERE category = 'productTitles' +), +deleted_data AS ( + DELETE FROM "i18n-texts_data" + WHERE textid IN (SELECT textid FROM deleted_textids) + RETURNING textid +), +deleted_texts AS ( + DELETE FROM "i18n-texts" + WHERE textid IN (SELECT textid FROM deleted_textids) + RETURNING textid +) +SELECT + (SELECT COUNT(*) FROM deleted_data) AS deleted_data_count, + (SELECT COUNT(*) FROM deleted_texts) AS deleted_texts_count;