good morning

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-08-06 08:11:05 +08:00
parent 141b7ab592
commit dcae93eb35
15 changed files with 81 additions and 204 deletions
@@ -1,15 +1,15 @@
'use strict';
// The live enum type backing `type` is named task_requirement_type (not the
// Sequelize-default enum_task_requirements_type) — submit_text/pass_quiz were
// added to it later via ALTER TYPE (20260715000001). Declared here with the
// full merged value set.
// Sequelize-default enum_task_requirements_type) — submit_text was added to
// it later via ALTER TYPE (20260715000001). Declared here with the full
// merged value set.
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('task_requirements', {
requirement_id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, primaryKey: true },
task_id: { type: Sequelize.UUID, allowNull: false, references: { model: 'tasks', key: 'task_id' }, onDelete: 'CASCADE' },
type: { type: Sequelize.ENUM('visit_link', 'upload_file', 'read_course', 'read_unit', 'read_lesson', 'submit_text', 'pass_quiz'), allowNull: false },
type: { type: Sequelize.ENUM('visit_link', 'upload_file', 'read_course', 'read_unit', 'read_lesson', 'submit_text'), allowNull: false },
link_url: { type: Sequelize.STRING, allowNull: true },
link_label: { type: Sequelize.STRING, allowNull: true },
allowed_file_types: { type: Sequelize.JSONB, allowNull: true },
@@ -1,8 +1,7 @@
'use strict';
// `type` is STRING + an explicit CHECK constraint (check_type) — pass_quiz
// was added to the value set via a DROP/ADD CONSTRAINT swap (20260709000003),
// not ALTER TYPE, confirming this column isn't a native enum on this DB.
// `type` is STRING + an explicit CHECK constraint (check_type) — this
// column isn't a native enum on this DB.
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('task_progress', {
@@ -22,7 +21,7 @@ module.exports = {
await queryInterface.sequelize.query(
`ALTER TABLE task_progress ADD CONSTRAINT check_type
CHECK (type IN ('read_course', 'read_unit', 'read_lesson', 'pass_quiz'))`
CHECK (type IN ('read_course', 'read_unit', 'read_lesson'))`
);
await queryInterface.addIndex('task_progress', { fields: ['requirement_id', 'user_id', 'reference_id'], unique: true, name: 'uq_tp_requirement_user_reference' });