mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added offer_redemptions table to database
refs https://github.com/TryGhost/Team/issues/1132 This will be used to store Offer Redemptions, which will be used to list the Offers which a Member has redeemed, as well as the number of times an Offer has been redeemed.
This commit is contained in:
parent
64f2aa2af5
commit
b93e7d7f7c
4 changed files with 17 additions and 2 deletions
|
@ -37,7 +37,8 @@ const BACKUP_TABLES = [
|
||||||
'members_paid_subscription_events',
|
'members_paid_subscription_events',
|
||||||
'members_subscribe_events',
|
'members_subscribe_events',
|
||||||
'members_product_events',
|
'members_product_events',
|
||||||
'offers'
|
'offers',
|
||||||
|
'offer_redemptions'
|
||||||
];
|
];
|
||||||
|
|
||||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
const {addTable} = require('../../utils');
|
||||||
|
|
||||||
|
module.exports = addTable('offer_redemptions', {
|
||||||
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||||
|
offer_id: {type: 'string', maxlength: 24, nullable: false, references: 'offers.id', cascadeDelete: true},
|
||||||
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||||
|
subscription_id: {type: 'string', maxlength: 24, nullable: false, references: 'members_stripe_customers_subscriptions.id', cascadeDelete: true}
|
||||||
|
});
|
|
@ -529,6 +529,12 @@ module.exports = {
|
||||||
plan_amount: {type: 'integer', nullable: false},
|
plan_amount: {type: 'integer', nullable: false},
|
||||||
plan_currency: {type: 'string', maxLength: 3, nullable: false}
|
plan_currency: {type: 'string', maxLength: 3, nullable: false}
|
||||||
},
|
},
|
||||||
|
offer_redemptions: {
|
||||||
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||||
|
offer_id: {type: 'string', maxlength: 24, nullable: false, references: 'offers.id', cascadeDelete: true},
|
||||||
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||||
|
subscription_id: {type: 'string', maxlength: 24, nullable: false, references: 'members_stripe_customers_subscriptions.id'}
|
||||||
|
},
|
||||||
members_subscribe_events: {
|
members_subscribe_events: {
|
||||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||||
member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true},
|
member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true},
|
||||||
|
|
|
@ -32,7 +32,7 @@ const defaultSettings = require('../../../../../core/server/data/schema/default-
|
||||||
*/
|
*/
|
||||||
describe('DB version integrity', function () {
|
describe('DB version integrity', function () {
|
||||||
// Only these variables should need updating
|
// Only these variables should need updating
|
||||||
const currentSchemaHash = '2b5213b4ead41042194d4a9051bf0e8a';
|
const currentSchemaHash = '33ec13330fc7384b849ae4b0e506017d';
|
||||||
const currentFixturesHash = 'c064a1b57c594e6a8d36f9e884df0a2a';
|
const currentFixturesHash = 'c064a1b57c594e6a8d36f9e884df0a2a';
|
||||||
const currentSettingsHash = 'aa3fcbc8ab119b630aeda7366ead5493';
|
const currentSettingsHash = 'aa3fcbc8ab119b630aeda7366ead5493';
|
||||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||||
|
|
Loading…
Add table
Reference in a new issue