From cdd98b26c7fc677c3e6abc6c58e1bb1fbdfee6ec Mon Sep 17 00:00:00 2001 From: Tereshchenko Aleksandr Date: Tue, 20 Aug 2024 13:04:40 +0300 Subject: [PATCH] Remove STARTED stage from the backend and database --- ...240820_00_remove_started_status_option.cjs | 20 +++++++++++++++++++ src/server/db/models/Thesis.ts | 2 +- src/server/types.ts | 1 - 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/server/db/migrations/20240820_00_remove_started_status_option.cjs diff --git a/src/server/db/migrations/20240820_00_remove_started_status_option.cjs b/src/server/db/migrations/20240820_00_remove_started_status_option.cjs new file mode 100644 index 00000000..82c1e96a --- /dev/null +++ b/src/server/db/migrations/20240820_00_remove_started_status_option.cjs @@ -0,0 +1,20 @@ +const { DataTypes, UUIDV4 } = require('sequelize') + +module.exports = { + up: async queryInterface => { + // remove the 'started' option from the status column of theses table + await queryInterface.changeColumn('theses', 'status', { + type: DataTypes.ENUM, + values: ['PLANNING', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED'], + allowNull: false, + }) + }, + down: async queryInterface => { + // add the 'started' option back to the status column of theses table + await queryInterface.changeColumn('theses', 'status', { + type: DataTypes.ENUM, + values: ['PLANNING', 'STARTED', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED'], + allowNull: false, + }) + } +} diff --git a/src/server/db/models/Thesis.ts b/src/server/db/models/Thesis.ts index 0d58c639..a9964083 100644 --- a/src/server/db/models/Thesis.ts +++ b/src/server/db/models/Thesis.ts @@ -58,7 +58,7 @@ Thesis.init( }, status: { type: DataTypes.ENUM, - values: ['PLANNING', 'STARTED', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED'], + values: ['PLANNING', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED'], allowNull: false, }, startDate: { diff --git a/src/server/types.ts b/src/server/types.ts index 5c519d16..1612998e 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -42,7 +42,6 @@ export interface RequestWithUser extends Request { export type ThesisStatus = | 'PLANNING' - | 'STARTED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED'