From 19d2288df49c573d97ab13846e31f74b933bd8e8 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Thu, 30 Jan 2020 18:57:11 +0800 Subject: [PATCH 1/2] feat: increase length of ProjectTemplate.info field --- .../20200130_increase_project_template_info_length.sql | 10 ++++++++++ src/models/projectTemplate.js | 2 +- src/routes/projectTemplates/create.js | 2 +- src/routes/projectTemplates/update.js | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 migrations/20200130_increase_project_template_info_length.sql diff --git a/migrations/20200130_increase_project_template_info_length.sql b/migrations/20200130_increase_project_template_info_length.sql new file mode 100644 index 00000000..ac6ecd4f --- /dev/null +++ b/migrations/20200130_increase_project_template_info_length.sql @@ -0,0 +1,10 @@ +-- +-- UPDATE EXISTING TABLES: +-- project_templates: +-- modify column `info` + +-- +-- project_templates + + +ALTER TABLE project_templates ALTER COLUMN "info" TYPE character varying(1024); diff --git a/src/models/projectTemplate.js b/src/models/projectTemplate.js index 3b61600b..75c8fe48 100644 --- a/src/models/projectTemplate.js +++ b/src/models/projectTemplate.js @@ -16,7 +16,7 @@ module.exports = (sequelize, DataTypes) => { metadata: { type: DataTypes.JSON, allowNull: false, defaultValue: {} }, icon: { type: DataTypes.STRING(255), allowNull: false }, question: { type: DataTypes.STRING(255), allowNull: false }, - info: { type: DataTypes.STRING(255), allowNull: false }, + info: { type: DataTypes.STRING(1024), allowNull: false }, aliases: { type: DataTypes.JSON, allowNull: false }, scope: { type: DataTypes.JSON, allowNull: true }, phases: { type: DataTypes.JSON, allowNull: true }, diff --git a/src/routes/projectTemplates/create.js b/src/routes/projectTemplates/create.js index 9e68fc47..473139f7 100644 --- a/src/routes/projectTemplates/create.js +++ b/src/routes/projectTemplates/create.js @@ -22,7 +22,7 @@ const schema = { metadata: Joi.object(), icon: Joi.string().max(255).required(), question: Joi.string().max(255).required(), - info: Joi.string().max(255).required(), + info: Joi.string().max(1024).required(), aliases: Joi.array().required(), scope: Joi.object().empty(null), phases: Joi.object().empty(null), diff --git a/src/routes/projectTemplates/update.js b/src/routes/projectTemplates/update.js index b2755771..6661a520 100644 --- a/src/routes/projectTemplates/update.js +++ b/src/routes/projectTemplates/update.js @@ -25,7 +25,7 @@ const schema = { metadata: Joi.object(), icon: Joi.string().max(255), question: Joi.string().max(255), - info: Joi.string().max(255), + info: Joi.string().max(1024), aliases: Joi.array(), scope: Joi.object().empty(null), phases: Joi.object().empty(null), From 4f6ac735ac2cb82f53c5202bdf8da21d6a7c1486 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Fri, 31 Jan 2020 09:56:01 +0800 Subject: [PATCH 2/2] feat: increase length of ProjectType's and ProductCategory's "info" field length --- ...20200130_increase_metadata_info_length.sql | 23 +++++++++++++++++++ ..._increase_project_template_info_length.sql | 10 -------- src/models/productCategory.js | 2 +- src/models/projectType.js | 2 +- src/routes/productCategories/create.js | 2 +- src/routes/productCategories/update.js | 2 +- src/routes/projectTypes/create.js | 2 +- src/routes/projectTypes/update.js | 2 +- 8 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 migrations/20200130_increase_metadata_info_length.sql delete mode 100644 migrations/20200130_increase_project_template_info_length.sql diff --git a/migrations/20200130_increase_metadata_info_length.sql b/migrations/20200130_increase_metadata_info_length.sql new file mode 100644 index 00000000..677124d2 --- /dev/null +++ b/migrations/20200130_increase_metadata_info_length.sql @@ -0,0 +1,23 @@ +-- +-- UPDATE EXISTING TABLES: +-- project_templates: +-- modify column `info` +-- project_types: +-- modify column `info` +-- product_categories: +-- modify column `info` + +-- +-- project_templates + +ALTER TABLE project_templates ALTER COLUMN "info" TYPE character varying(1024); + +-- +-- project_types + +ALTER TABLE project_types ALTER COLUMN "info" TYPE character varying(1024); + +-- +-- product_categories + +ALTER TABLE product_categories ALTER COLUMN "info" TYPE character varying(1024); \ No newline at end of file diff --git a/migrations/20200130_increase_project_template_info_length.sql b/migrations/20200130_increase_project_template_info_length.sql deleted file mode 100644 index ac6ecd4f..00000000 --- a/migrations/20200130_increase_project_template_info_length.sql +++ /dev/null @@ -1,10 +0,0 @@ --- --- UPDATE EXISTING TABLES: --- project_templates: --- modify column `info` - --- --- project_templates - - -ALTER TABLE project_templates ALTER COLUMN "info" TYPE character varying(1024); diff --git a/src/models/productCategory.js b/src/models/productCategory.js index 07f745ef..80a08ab3 100644 --- a/src/models/productCategory.js +++ b/src/models/productCategory.js @@ -9,7 +9,7 @@ module.exports = function defineProductCategory(sequelize, DataTypes) { displayName: { type: DataTypes.STRING(255), allowNull: false }, icon: { type: DataTypes.STRING(255), allowNull: false }, question: { type: DataTypes.STRING(255), allowNull: false }, - info: { type: DataTypes.STRING(255), allowNull: false }, + info: { type: DataTypes.STRING(1024), allowNull: false }, aliases: { type: DataTypes.JSON, allowNull: false }, disabled: { type: DataTypes.BOOLEAN, defaultValue: false }, hidden: { type: DataTypes.BOOLEAN, defaultValue: false }, diff --git a/src/models/projectType.js b/src/models/projectType.js index 19618698..f233f3b5 100644 --- a/src/models/projectType.js +++ b/src/models/projectType.js @@ -6,7 +6,7 @@ module.exports = function definePhaseProduct(sequelize, DataTypes) { displayName: { type: DataTypes.STRING(255), allowNull: false }, icon: { type: DataTypes.STRING(255), allowNull: false }, question: { type: DataTypes.STRING(255), allowNull: false }, - info: { type: DataTypes.STRING(255), allowNull: false }, + info: { type: DataTypes.STRING(1024), allowNull: false }, aliases: { type: DataTypes.JSON, allowNull: false }, disabled: { type: DataTypes.BOOLEAN, defaultValue: false }, hidden: { type: DataTypes.BOOLEAN, defaultValue: false }, diff --git a/src/routes/productCategories/create.js b/src/routes/productCategories/create.js index 4abce161..ff97a3d5 100644 --- a/src/routes/productCategories/create.js +++ b/src/routes/productCategories/create.js @@ -17,7 +17,7 @@ const schema = { displayName: Joi.string().max(255).required(), icon: Joi.string().max(255).required(), question: Joi.string().max(255).required(), - info: Joi.string().max(255).required(), + info: Joi.string().max(1024).required(), aliases: Joi.array().required(), disabled: Joi.boolean().optional(), hidden: Joi.boolean().optional(), diff --git a/src/routes/productCategories/update.js b/src/routes/productCategories/update.js index f4b7611e..1119e27e 100644 --- a/src/routes/productCategories/update.js +++ b/src/routes/productCategories/update.js @@ -21,7 +21,7 @@ const schema = { displayName: Joi.string().max(255).optional(), icon: Joi.string().max(255).optional(), question: Joi.string().max(255).optional(), - info: Joi.string().max(255).optional(), + info: Joi.string().max(1024).optional(), aliases: Joi.array().optional(), disabled: Joi.boolean().optional(), hidden: Joi.boolean().optional(), diff --git a/src/routes/projectTypes/create.js b/src/routes/projectTypes/create.js index 88051a51..462da1b7 100644 --- a/src/routes/projectTypes/create.js +++ b/src/routes/projectTypes/create.js @@ -17,7 +17,7 @@ const schema = { displayName: Joi.string().max(255).required(), icon: Joi.string().max(255).required(), question: Joi.string().max(255).required(), - info: Joi.string().max(255).required(), + info: Joi.string().max(1024).required(), aliases: Joi.array().required(), disabled: Joi.boolean().optional(), hidden: Joi.boolean().optional(), diff --git a/src/routes/projectTypes/update.js b/src/routes/projectTypes/update.js index 9cb09002..174ee01a 100644 --- a/src/routes/projectTypes/update.js +++ b/src/routes/projectTypes/update.js @@ -20,7 +20,7 @@ const schema = { displayName: Joi.string().max(255).optional(), icon: Joi.string().max(255).optional(), question: Joi.string().max(255).optional(), - info: Joi.string().max(255).optional(), + info: Joi.string().max(1024).optional(), aliases: Joi.array().optional(), disabled: Joi.boolean().optional(), hidden: Joi.boolean().optional(),