mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
Added stripe_products
and stripe_prices
tables (#12858)
refs https://github.com/TryGhost/Team/issues/586 - Add the `stripe_products` table, so that we can map Stripe Products to Products in Ghost - Add the `stripe_prices` table, so that we can associate Stripe Prices to Products table
This commit is contained in:
parent
25182b7b82
commit
94766c05bf
@ -33,6 +33,8 @@ const BACKUP_TABLES = [
|
||||
'snippets',
|
||||
'tokens',
|
||||
'sessions',
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'mobiledoc_revisions',
|
||||
'email_batches',
|
||||
'email_recipients',
|
||||
|
@ -0,0 +1,9 @@
|
||||
const {addTable} = require('../../utils');
|
||||
|
||||
module.exports = addTable('stripe_products', {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
product_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'products.id'},
|
||||
stripe_product_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
const {addTable} = require('../../utils');
|
||||
|
||||
module.exports = addTable('stripe_prices', {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
stripe_price_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
|
||||
stripe_product_id: {type: 'string', maxlength: 255, nullable: false, unique: false, references: 'stripe_products.stripe_product_id'},
|
||||
active: {type: 'boolean', nullable: false},
|
||||
livemode: {type: 'boolean', nullable: false},
|
||||
nickname: {type: 'string', maxlength: 50, nullable: true},
|
||||
currency: {type: 'string', maxLength: 3, nullable: false},
|
||||
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: false},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
});
|
@ -475,6 +475,27 @@ module.exports = {
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
source: {type: 'string', maxlength: 50, nullable: true}
|
||||
},
|
||||
stripe_products: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
product_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'products.id'},
|
||||
stripe_product_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
},
|
||||
stripe_prices: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
stripe_price_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
|
||||
stripe_product_id: {type: 'string', maxlength: 255, nullable: false, unique: false, references: 'stripe_products.stripe_product_id'},
|
||||
active: {type: 'boolean', nullable: false},
|
||||
livemode: {type: 'boolean', nullable: false},
|
||||
nickname: {type: 'string', maxlength: 50, nullable: true},
|
||||
currency: {type: 'string', maxLength: 3, nullable: false},
|
||||
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: false},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
},
|
||||
actions: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
resource_id: {type: 'string', maxlength: 24, nullable: true},
|
||||
|
@ -53,6 +53,8 @@ describe('Exporter', function () {
|
||||
'posts_meta',
|
||||
'posts_tags',
|
||||
'products',
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'roles',
|
||||
'roles_users',
|
||||
'sessions',
|
||||
|
@ -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 = '9d62f0a673a4f02af8a980495793ac4f';
|
||||
const currentSchemaHash = 'a507f692edce7d13d1b75c124b3a30b7';
|
||||
const currentFixturesHash = '779f29a247161414025637e10e99a278';
|
||||
const currentSettingsHash = '7ac732b994a5bb1565f88c8a84872964';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
Loading…
Reference in New Issue
Block a user