Files
starr-philproperties/database/migrations/20260101000028-create-task-requirements.js
T
kennethobsequio 439bb33f77 ready to test
Testing

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
2026-06-22 10:06:58 +08:00

31 lines
1.6 KiB
JavaScript

'use strict';
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'), allowNull: false },
link_url: { type: Sequelize.STRING, allowNull: true },
link_label: { type: Sequelize.STRING, allowNull: true },
allowed_file_types: { type: Sequelize.JSONB, allowNull: true },
max_file_count: { type: Sequelize.INTEGER, allowNull: true, defaultValue: 1 },
reference_id: { type: Sequelize.UUID, allowNull: true },
reference_label: { type: Sequelize.STRING, allowNull: true },
order: { type: Sequelize.INTEGER, defaultValue: 0 },
createdBy: { type: Sequelize.INTEGER, allowNull: true },
updatedBy: { type: Sequelize.INTEGER, allowNull: true },
deletedBy: { type: Sequelize.INTEGER, allowNull: true },
createdAt: { type: Sequelize.DATE, allowNull: false },
updatedAt: { type: Sequelize.DATE, allowNull: false },
deletedAt: { type: Sequelize.DATE, allowNull: true },
});
await queryInterface.addIndex('task_requirements', ['task_id']);
},
async down(queryInterface) {
await queryInterface.dropTable('task_requirements');
},
};