mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
28 lines
1.3 KiB
JavaScript
28 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable('tasks', {
|
|
task_id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, primaryKey: true },
|
|
task_list_id: { type: Sequelize.UUID, allowNull: false, references: { model: 'task_lists', key: 'task_list_id' }, onDelete: 'CASCADE' },
|
|
name: { type: Sequelize.STRING, allowNull: false },
|
|
description: { type: Sequelize.TEXT, allowNull: true },
|
|
deadline: { type: Sequelize.DATE, allowNull: true },
|
|
status: { type: Sequelize.ENUM('pending', 'in_progress', 'completed', 'overdue'), defaultValue: 'pending', allowNull: false },
|
|
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('tasks', ['task_list_id']);
|
|
await queryInterface.addIndex('tasks', ['status']);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable('tasks');
|
|
},
|
|
};
|