'use strict'; // Part 1A — task_progress.type gains 'pass_quiz' (reference_id becomes a // quiz_id for that type; completed is computed from QuizAttempt.passed the // same way unit-quiz has_passed already is). Same drop/recreate CHECK // constraint pattern as 20260101000058-add-exclusive-to-course-subscription.js. module.exports = { async up(queryInterface) { await queryInterface.sequelize.query( `ALTER TABLE task_progress DROP CONSTRAINT IF EXISTS check_type` ); await queryInterface.sequelize.query( `ALTER TABLE task_progress ADD CONSTRAINT check_type CHECK (type IN ('read_course', 'read_unit', 'read_lesson', 'pass_quiz'))` ); }, async down(queryInterface) { await queryInterface.sequelize.query( `ALTER TABLE task_progress DROP CONSTRAINT IF EXISTS check_type` ); await queryInterface.sequelize.query( `ALTER TABLE task_progress ADD CONSTRAINT check_type CHECK (type IN ('read_course', 'read_unit', 'read_lesson'))` ); }, };