mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
29 lines
1018 B
JavaScript
29 lines
1018 B
JavaScript
'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'))`
|
|
);
|
|
},
|
|
};
|