tududi/backend/migrations/20250621221841-add-completed-at-to-tasks.js
Antonis Anastasiadis e594d1075b
Linting cleanup (#99)
* Add eslint and prettier dependencies and configs

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

22 lines
663 B
JavaScript

'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
// Add completed_at column to tasks table
await queryInterface.addColumn('tasks', 'completed_at', {
type: Sequelize.DATE,
allowNull: true,
});
// Add an index for better query performance
await queryInterface.addIndex('tasks', ['completed_at']);
},
async down(queryInterface, Sequelize) {
// Remove the index first
await queryInterface.removeIndex('tasks', ['completed_at']);
// Remove the completed_at column
await queryInterface.removeColumn('tasks', 'completed_at');
},
};