tududi/backend/migrations/20250920075916-remove-active-column.js
Chris 9d2b1895af
Feat/add project states (#354)
* Scaffold project states

* fixup! Scaffold project states

* Fix blinking project modal

* fixup! Fix blinking project modal

* fixup! fixup! Fix blinking project modal

* Fix an issue with the tag input autosuggest

* fixup! Fix an issue with the tag input autosuggest

* fixup! fixup! Fix an issue with the tag input autosuggest

* Add state to project details

* fixup! Add state to project details

* Add state indicator on project cards

* fixup! Add state indicator on project cards
2025-09-29 16:04:25 +03:00

36 lines
963 B
JavaScript

'use strict';
const {
safeRemoveColumn,
safeAddColumns,
} = require('../utils/migration-utils');
module.exports = {
up: async (queryInterface, Sequelize) => {
// Remove the active column from projects table
await safeRemoveColumn(queryInterface, 'projects', 'active');
},
down: async (queryInterface, Sequelize) => {
// Add the active column back
await safeAddColumns(queryInterface, 'projects', [
{
name: 'active',
definition: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: true,
},
},
]);
// Restore active values based on state
await queryInterface.sequelize.query(`
UPDATE projects
SET active = CASE
WHEN state = 'in_progress' THEN 1
ELSE 0
END
`);
},
};