From b4d9ee0b4e2f3700509b7709d898dae896ddeba4 Mon Sep 17 00:00:00 2001 From: Fabien 'egg' O'Carroll Date: Tue, 4 May 2021 13:41:48 +0100 Subject: [PATCH] Added description to Products & Prices (#12916) refs https://github.com/TryGhost/Team/issues/586 The `products` and `stripe_prices` tables are missing a description column which will be used by Portal to display information about the products and prices --- .../versions/4.5/01-add-stripe-price-description-column.js | 7 +++++++ .../versions/4.5/02-add-product-description-column.js | 7 +++++++ core/server/data/schema/schema.js | 2 ++ test/unit/data/schema/integrity_spec.js | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 core/server/data/migrations/versions/4.5/01-add-stripe-price-description-column.js create mode 100644 core/server/data/migrations/versions/4.5/02-add-product-description-column.js diff --git a/core/server/data/migrations/versions/4.5/01-add-stripe-price-description-column.js b/core/server/data/migrations/versions/4.5/01-add-stripe-price-description-column.js new file mode 100644 index 0000000000..44cb3e0929 --- /dev/null +++ b/core/server/data/migrations/versions/4.5/01-add-stripe-price-description-column.js @@ -0,0 +1,7 @@ +const {createAddColumnMigration} = require('../../utils'); + +module.exports = createAddColumnMigration('stripe_prices', 'description', { + type: 'string', + maxlength: 191, + nullable: true +}); diff --git a/core/server/data/migrations/versions/4.5/02-add-product-description-column.js b/core/server/data/migrations/versions/4.5/02-add-product-description-column.js new file mode 100644 index 0000000000..66106cd7a7 --- /dev/null +++ b/core/server/data/migrations/versions/4.5/02-add-product-description-column.js @@ -0,0 +1,7 @@ +const {createAddColumnMigration} = require('../../utils'); + +module.exports = createAddColumnMigration('products', 'description', { + type: 'string', + maxlength: 191, + nullable: true +}); diff --git a/core/server/data/schema/schema.js b/core/server/data/schema/schema.js index 6440dcc387..a419392dbd 100644 --- a/core/server/data/schema/schema.js +++ b/core/server/data/schema/schema.js @@ -366,6 +366,7 @@ module.exports = { id: {type: 'string', maxlength: 24, nullable: false, primary: true}, name: {type: 'string', maxlength: 191, nullable: false, unique: true}, slug: {type: 'string', maxlength: 191, nullable: false, unique: true}, + description: {type: 'string', maxlength: 191, nullable: true}, created_at: {type: 'dateTime', nullable: false}, updated_at: {type: 'dateTime', nullable: true} }, @@ -496,6 +497,7 @@ module.exports = { amount: {type: 'integer', nullable: false}, type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'recurring', validations: {isIn: [['recurring', 'one_time']]}}, interval: {type: 'string', maxlength: 50, nullable: true}, + description: {type: 'string', maxlength: 191, nullable: true}, created_at: {type: 'dateTime', nullable: false}, updated_at: {type: 'dateTime', nullable: true} }, diff --git a/test/unit/data/schema/integrity_spec.js b/test/unit/data/schema/integrity_spec.js index d5f6eb8d20..035618850c 100644 --- a/test/unit/data/schema/integrity_spec.js +++ b/test/unit/data/schema/integrity_spec.js @@ -32,7 +32,7 @@ const defaultSettings = require('../../../../core/server/data/schema/default-set */ describe('DB version integrity', function () { // Only these variables should need updating - const currentSchemaHash = 'c31e5e88461bbc015a9e50561d07f6f7'; + const currentSchemaHash = 'b7bca80554f3946cd2f83e0e99ff3532'; const currentFixturesHash = 'b24801cf9f819e4c127316021877ad70'; const currentSettingsHash = 'b943cc3956eee3dd042f8394b2701d21'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';