From e3b971d2ea7989d8a60813d12e4d3d0fcbe5bc7d Mon Sep 17 00:00:00 2001 From: Anthony Benites <104385099+ec2sw@users.noreply.github.com> Date: Mon, 9 May 2022 17:41:28 -0400 Subject: [PATCH] feat: add description field to projects --- ...0509125335-add-description-field-to-projects.js | 14 ++++++++++++++ src/database/migrations/index.js | 5 +++++ src/models/projects/projects.modeltypes.cjs | 4 ++++ src/validations/projects.validations.js | 1 + 4 files changed, 24 insertions(+) create mode 100644 src/database/migrations/20220509125335-add-description-field-to-projects.js diff --git a/src/database/migrations/20220509125335-add-description-field-to-projects.js b/src/database/migrations/20220509125335-add-description-field-to-projects.js new file mode 100644 index 00000000..ccf732ce --- /dev/null +++ b/src/database/migrations/20220509125335-add-description-field-to-projects.js @@ -0,0 +1,14 @@ +'use strict'; + +export default { + async up(queryInterface, Sequelize) { + queryInterface.addColumn('projects', 'description', { + type: Sequelize.STRING, + allowNull: true, + }); + }, + + async down(queryInterface) { + queryInterface.removeColumn('projects', 'description'); + }, +}; diff --git a/src/database/migrations/index.js b/src/database/migrations/index.js index 2ee5f2ae..9d51ce28 100644 --- a/src/database/migrations/index.js +++ b/src/database/migrations/index.js @@ -20,6 +20,7 @@ import CreateMetaTable from './20220119211024-create-meta-table'; import CreateGoveranceTable from './20220315134151-create-governance-table'; import AddCommentColumnToDataModelTables from './20220428144558-add-comment-column-to-all-datamodels'; import AddSerialNumberFields from './20220504180739-add-serial-number-fields'; +import AddDescriptionFieldToProjects from './20220509125335-add-description-field-to-projects'; export const migrations = [ { @@ -114,4 +115,8 @@ export const migrations = [ migration: AddSerialNumberFields, name: '20220504180739-add-serial-number-fields.js', }, + { + migration: AddDescriptionFieldToProjects, + name: '20220509125335-add-description-field-to-projects', + }, ]; diff --git a/src/models/projects/projects.modeltypes.cjs b/src/models/projects/projects.modeltypes.cjs index 8b87512e..12682508 100644 --- a/src/models/projects/projects.modeltypes.cjs +++ b/src/models/projects/projects.modeltypes.cjs @@ -85,6 +85,10 @@ module.exports = { timeStaged: { type: Sequelize.STRING, }, + description: { + type: Sequelize.STRING, + allowNull: true, + }, createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW, diff --git a/src/validations/projects.validations.js b/src/validations/projects.validations.js index d4118055..362e3d0d 100644 --- a/src/validations/projects.validations.js +++ b/src/validations/projects.validations.js @@ -44,6 +44,7 @@ export const baseSchema = { .custom(pickListValidation('validationBody')) .optional(), validationDate: Joi.date().optional(), + description: Joi.string().optional(), /* Child Tables */ labels: Joi.array().items(labelSchema).min(1).optional(),