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