From cbb6337ae4857dcaa669385a87c006a46dac74a2 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Wed, 9 Oct 2019 12:37:57 +0700 Subject: [PATCH] Prefixed stripe_customers_subscriptions with members no-issue --- ...1-add-stripe-customers-subscriptions-table.js | 16 ++++++++-------- core/server/data/schema/schema.js | 2 +- .../models/stripe-customer-subscription.js | 2 +- core/test/unit/data/schema/integrity_spec.js | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/server/data/migrations/versions/3.0/01-add-stripe-customers-subscriptions-table.js b/core/server/data/migrations/versions/3.0/01-add-stripe-customers-subscriptions-table.js index 24a22722b2..8c9062416e 100644 --- a/core/server/data/migrations/versions/3.0/01-add-stripe-customers-subscriptions-table.js +++ b/core/server/data/migrations/versions/3.0/01-add-stripe-customers-subscriptions-table.js @@ -8,27 +8,27 @@ module.exports = { async up(options){ const conn = options.transacting || options.connection; - const hasTable = await conn.schema.hasTable('stripe_customers_subscriptions'); + const hasTable = await conn.schema.hasTable('members_stripe_customers_subscriptions'); if (hasTable) { - common.logging.warn('Adding table: stripe_customers_subscriptions'); + common.logging.warn('Adding table: members_stripe_customers_subscriptions'); return; } - common.logging.info('Adding table: stripe_customers_subscriptions'); - return commands.createTable('stripe_customers_subscriptions', conn); + common.logging.info('Adding table: members_stripe_customers_subscriptions'); + return commands.createTable('members_stripe_customers_subscriptions', conn); }, async down(options){ const conn = options.transacting || options.connection; - const hasTable = await conn.schema.hasTable('stripe_customers_subscriptions'); + const hasTable = await conn.schema.hasTable('members_stripe_customers_subscriptions'); if (!hasTable) { - common.logging.warn('Dropping table: stripe_customers_subscriptions'); + common.logging.warn('Dropping table: members_stripe_customers_subscriptions'); return; } - common.logging.info('Dropping table: stripe_customers_subscriptions'); - return commands.deleteTable('stripe_customers_subscriptions', conn); + common.logging.info('Dropping table: members_stripe_customers_subscriptions'); + return commands.deleteTable('members_stripe_customers_subscriptions', conn); } }; diff --git a/core/server/data/schema/schema.js b/core/server/data/schema/schema.js index d18303f4f6..b519e63c7d 100644 --- a/core/server/data/schema/schema.js +++ b/core/server/data/schema/schema.js @@ -403,7 +403,7 @@ module.exports = { updated_at: {type: 'dateTime', nullable: true}, updated_by: {type: 'string', maxlength: 24, nullable: true} }, - stripe_customers_subscriptions: { + members_stripe_customers_subscriptions: { id: {type: 'string', maxlength: 24, nullable: false, primary: true}, customer_id: {type: 'string', maxlength: 255, nullable: false, unique: false}, subscription_id: {type: 'string', maxlength: 255, nullable: false, unique: false}, diff --git a/core/server/models/stripe-customer-subscription.js b/core/server/models/stripe-customer-subscription.js index 5f9c51881d..8b4d40d03b 100644 --- a/core/server/models/stripe-customer-subscription.js +++ b/core/server/models/stripe-customer-subscription.js @@ -1,7 +1,7 @@ const ghostBookshelf = require('./base'); const StripeCustomerSubscription = ghostBookshelf.Model.extend({ - tableName: 'stripe_customers_subscriptions' + tableName: 'members_stripe_customers_subscriptions' }, { async upsert(data, unfilteredOptions) { const subscriptionId = unfilteredOptions.subscription_id; diff --git a/core/test/unit/data/schema/integrity_spec.js b/core/test/unit/data/schema/integrity_spec.js index 975b6e7bad..891814c867 100644 --- a/core/test/unit/data/schema/integrity_spec.js +++ b/core/test/unit/data/schema/integrity_spec.js @@ -19,7 +19,7 @@ var should = require('should'), */ describe('DB version integrity', function () { // Only these variables should need updating - const currentSchemaHash = '7458175ceb3eba6750700f23461cd4fb'; + const currentSchemaHash = 'a5341373370dc25009806963c1bc236f'; const currentFixturesHash = 'c7b485fe2f16517295bd35c761129729'; // If this test is failing, then it is likely a change has been made that requires a DB version bump,