updated db migration

This commit is contained in:
2026-07-20 12:28:46 +08:00
parent a2c9936f79
commit d665897ef5
129 changed files with 574 additions and 1878 deletions
@@ -0,0 +1,21 @@
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('task_list_groups', {
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' },
group_id: { type: Sequelize.BIGINT, allowNull: false, references: { model: 'user_groups', key: 'group_id' }, onDelete: 'CASCADE' },
assignedAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW, allowNull: false },
assignedBy: { type: Sequelize.BIGINT, allowNull: true },
});
await queryInterface.addIndex('task_list_groups', { fields: ['task_list_id', 'group_id'], unique: true, name: 'uq_task_list_group' });
await queryInterface.addIndex('task_list_groups', { fields: ['task_list_id'], name: 'idx_tlg_task_list_id' });
await queryInterface.addIndex('task_list_groups', { fields: ['group_id'], name: 'idx_tlg_group_id' });
},
async down(queryInterface) {
await queryInterface.dropTable('task_list_groups');
},
};