Files
yourpart3/backend/migrations-active/20261005000000-cleanup-bisaya-obsolete-srs-cards.cjs
Torsten Schulz (local) 73570426ca
All checks were successful
Deploy to production / deploy (push) Successful in 2m53s
fix(vocab): remove obsolete Bisaya SRS cards
2026-10-05 14:29:55 +02:00

37 lines
1.2 KiB
JavaScript

'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.
}
};