From 73570426caad194b6dff402f0256773d319cc3ed Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 5 Oct 2026 14:29:55 +0200 Subject: [PATCH] fix(vocab): remove obsolete Bisaya SRS cards --- ...0000-cleanup-bisaya-obsolete-srs-cards.cjs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 backend/migrations-active/20261005000000-cleanup-bisaya-obsolete-srs-cards.cjs diff --git a/backend/migrations-active/20261005000000-cleanup-bisaya-obsolete-srs-cards.cjs b/backend/migrations-active/20261005000000-cleanup-bisaya-obsolete-srs-cards.cjs new file mode 100644 index 0000000..830b5ca --- /dev/null +++ b/backend/migrations-active/20261005000000-cleanup-bisaya-obsolete-srs-cards.cjs @@ -0,0 +1,36 @@ +'use strict'; + +/** + * Removes obsolete or incorrectly split Bisaya SRS cards that were created by + * older course imports. The current course content already uses the intended + * Spanish-derived tens and complete repair phrases. + */ +module.exports = { + async up(queryInterface) { + await queryInterface.sequelize.query(` + DELETE FROM community.vocab_srs_item + WHERE course_id = 1 + AND ( + lower(learning) ~ '(kawhaan|katloan|kalim[- ]?an|kanum[- ]?an|kap[- ]?atan|kapitoan|kawaloan|kasiyaman)' + OR lower(reference) ~ '(kawhaan|katloan|kalim[- ]?an|kanum[- ]?an|kap[- ]?atan|kapitoan|kawaloan|kasiyaman)' + ); + + DELETE FROM community.vocab_srs_item + WHERE course_id = 1 + AND ( + ( + regexp_replace(lower(learning), '[[:punct:][:space:]]', '', 'g') = 'bitte' + AND regexp_replace(lower(reference), '[[:punct:][:space:]]', '', 'g') = 'palihug' + ) + OR ( + lower(learning) = 'bitte wiederholen' + AND lower(reference) IN ('palihug', 'palihug ka mubalik?') + ) + ); + `); + }, + + async down() { + // Deleted legacy cards cannot be reconstructed reliably. + } +};