tududi/backend/migrations/20250619000001-add-recurring-parent-id.js
Antonis Anastasiadis e594d1075b
Linting cleanup (#99)
* Add eslint and prettier dependencies and configs

* Lint project.
2025-07-01 11:40:09 +03:00

24 lines
728 B
JavaScript

'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn('tasks', 'recurring_parent_id', {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: 'tasks',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
});
// Add index for performance
await queryInterface.addIndex('tasks', ['recurring_parent_id']);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeIndex('tasks', ['recurring_parent_id']);
await queryInterface.removeColumn('tasks', 'recurring_parent_id');
},
};