0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added ghost_subscription_id column to members_stripe_customers_subscriptions

refs https://github.com/TryGhost/Team/issues/2034

- this table will be used to link Stripe subscriptions to Ghost
  subscriptions via a foreign key that we add at a later point
- this also includes `constraintName` as the auto-generated one would be
  too long for MySQL 8
This commit is contained in:
Daniel Lockyer 2022-10-14 16:05:16 +07:00 committed by Daniel Lockyer
parent 318a5a809c
commit 02c8690e87
3 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,10 @@
const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('members_stripe_customers_subscriptions', 'ghost_subscription_id', {
type: 'string',
maxlength: 24,
nullable: true,
references: 'subscriptions.id',
constraintName: 'mscs_ghost_subscription_id_foreign',
cascadeDelete: true
});

View file

@ -657,6 +657,7 @@ module.exports = {
members_stripe_customers_subscriptions: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
customer_id: {type: 'string', maxlength: 255, nullable: false, unique: false, references: 'members_stripe_customers.customer_id', cascadeDelete: true},
ghost_subscription_id: {type: 'string', maxlength: 24, nullable: true, references: 'subscriptions.id', constraintName: 'mscs_ghost_subscription_id_foreign', cascadeDelete: true},
subscription_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
stripe_price_id: {type: 'string', maxlength: 255, nullable: false, unique: false, index: true, defaultTo: ''},
status: {type: 'string', maxlength: 50, nullable: false},

View file

@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '76cfd2230c02c428e9505f6b9a3936ec';
const currentSchemaHash = 'bb9d35d276f407c4a353e22e1e5b5538';
const currentFixturesHash = 'dcb7ba7c66b4b98d6c26a722985e756a';
const currentSettingsHash = '2978a5684a2d5fcf089f61f5d368a0c0';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';