From 47e266e6d36766d2d9a194950b3486f5bdb602be Mon Sep 17 00:00:00 2001 From: Fabien 'egg' O'Carroll <fabien@allou.is> Date: Mon, 23 Nov 2020 15:36:14 +0000 Subject: [PATCH] Added cancellation_reason column to stripe subscriptions (#12405) refs #12403 This will allow us to store the reason for each individual subscription cancellation. --- .../versions/3.39/04-add-cancellation-reason-column.js | 7 +++++++ core/server/data/schema/schema.js | 1 + test/unit/data/schema/integrity_spec.js | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 core/server/data/migrations/versions/3.39/04-add-cancellation-reason-column.js diff --git a/core/server/data/migrations/versions/3.39/04-add-cancellation-reason-column.js b/core/server/data/migrations/versions/3.39/04-add-cancellation-reason-column.js new file mode 100644 index 0000000000..1831345f5e --- /dev/null +++ b/core/server/data/migrations/versions/3.39/04-add-cancellation-reason-column.js @@ -0,0 +1,7 @@ +const {createAddColumnMigration} = require('../../utils'); + +module.exports = createAddColumnMigration('members_stripe_customers_subscriptions', 'cancellation_reason', { + type: 'string', + maxlength: 500, + nullable: true +}); diff --git a/core/server/data/schema/schema.js b/core/server/data/schema/schema.js index a752897fb9..905bfa32d1 100644 --- a/core/server/data/schema/schema.js +++ b/core/server/data/schema/schema.js @@ -416,6 +416,7 @@ module.exports = { plan_id: {type: 'string', maxlength: 255, nullable: false, unique: false}, status: {type: 'string', maxlength: 50, nullable: false}, cancel_at_period_end: {type: 'bool', nullable: false, defaultTo: false}, + cancellation_reason: {type: 'string', maxlength: 500, nullable: true}, current_period_end: {type: 'dateTime', nullable: false}, start_date: {type: 'dateTime', nullable: false}, default_payment_card_last4: {type: 'string', maxlength: 4, nullable: true}, diff --git a/test/unit/data/schema/integrity_spec.js b/test/unit/data/schema/integrity_spec.js index c893de331e..04ea0ecbfc 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 = '6a5b00d987f045f364c6581082cd0b03'; + const currentSchemaHash = 'ce6d902fd2b0e3921ffb76d61a35e285'; const currentFixturesHash = 'd46d696c94d03e41a5903500547fea77'; const currentSettingsHash = 'b7c0c2c6a4c61561dfefe642470d30f8'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';