mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Added members_created_events table & model
refs https://github.com/TryGhost/Team/issues/1802
This commit is contained in:
parent
f18cc0185b
commit
03155a61ff
@ -31,6 +31,7 @@ const BACKUP_TABLES = [
|
|||||||
'members_paid_subscription_events',
|
'members_paid_subscription_events',
|
||||||
'members_subscribe_events',
|
'members_subscribe_events',
|
||||||
'members_product_events',
|
'members_product_events',
|
||||||
|
'members_created_events',
|
||||||
'members_newsletters',
|
'members_newsletters',
|
||||||
'comments',
|
'comments',
|
||||||
'comment_likes',
|
'comment_likes',
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
const {addTable} = require('../../utils');
|
||||||
|
|
||||||
|
module.exports = addTable('members_created_events', {
|
||||||
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||||
|
created_at: {type: 'dateTime', nullable: false},
|
||||||
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||||
|
attribution_id: {type: 'string', maxlength: 24, nullable: true},
|
||||||
|
attribution_type: {type: 'string', maxlength: 50, nullable: true},
|
||||||
|
attribution_url: {type: 'string', maxlength: 2000, nullable: true},
|
||||||
|
source: {type: 'string', maxlength: 50, nullable: false}
|
||||||
|
});
|
@ -474,6 +474,15 @@ module.exports = {
|
|||||||
product_id: {type: 'string', maxlength: 24, nullable: false, references: 'products.id', cascadeDelete: true},
|
product_id: {type: 'string', maxlength: 24, nullable: false, references: 'products.id', cascadeDelete: true},
|
||||||
sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0}
|
sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0}
|
||||||
},
|
},
|
||||||
|
members_created_events: {
|
||||||
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||||
|
created_at: {type: 'dateTime', nullable: false},
|
||||||
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||||
|
attribution_id: {type: 'string', maxlength: 24, nullable: true},
|
||||||
|
attribution_type: {type: 'string', maxlength: 50, nullable: true},
|
||||||
|
attribution_url: {type: 'string', maxlength: 2000, nullable: true},
|
||||||
|
source: {type: 'string', maxlength: 50, nullable: false}
|
||||||
|
},
|
||||||
members_cancel_events: {
|
members_cancel_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, references: 'members.id', cascadeDelete: true},
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||||
|
26
ghost/core/core/server/models/member-created-event.js
Normal file
26
ghost/core/core/server/models/member-created-event.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
const errors = require('@tryghost/errors');
|
||||||
|
const ghostBookshelf = require('./base');
|
||||||
|
|
||||||
|
const MemberCreatedEvent = ghostBookshelf.Model.extend({
|
||||||
|
tableName: 'members_created_events',
|
||||||
|
|
||||||
|
member() {
|
||||||
|
return this.belongsTo('Member', 'member_id', 'id');
|
||||||
|
},
|
||||||
|
|
||||||
|
attribution() {
|
||||||
|
return this.belongsTo('Post', 'attribution_id', 'id');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
async edit() {
|
||||||
|
throw new errors.IncorrectUsageError({message: 'Cannot edit MemberCreatedEvent'});
|
||||||
|
},
|
||||||
|
|
||||||
|
async destroy() {
|
||||||
|
throw new errors.IncorrectUsageError({message: 'Cannot destroy MemberCreatedEvent'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
MemberCreatedEvent: ghostBookshelf.model('MemberCreatedEvent', MemberCreatedEvent)
|
||||||
|
};
|
@ -50,6 +50,8 @@ describe('Exporter', function () {
|
|||||||
'members_stripe_customers',
|
'members_stripe_customers',
|
||||||
'members_stripe_customers_subscriptions',
|
'members_stripe_customers_subscriptions',
|
||||||
'members_subscribe_events',
|
'members_subscribe_events',
|
||||||
|
'members_created_events',
|
||||||
|
'subscription_created_events',
|
||||||
'migrations',
|
'migrations',
|
||||||
'migrations_lock',
|
'migrations_lock',
|
||||||
'mobiledoc_revisions',
|
'mobiledoc_revisions',
|
||||||
|
@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
|
|||||||
*/
|
*/
|
||||||
describe('DB version integrity', function () {
|
describe('DB version integrity', function () {
|
||||||
// Only these variables should need updating
|
// Only these variables should need updating
|
||||||
const currentSchemaHash = '45337ae85129a98e4c1b551cc91790da';
|
const currentSchemaHash = 'f5f7bc63bf9484bf50a0e554604802b3';
|
||||||
const currentFixturesHash = '0ae1887dd0b42508be946bdbd20d41c8';
|
const currentFixturesHash = '0ae1887dd0b42508be946bdbd20d41c8';
|
||||||
const currentSettingsHash = 'd54210758b7054e2174fd34aa2320ad7';
|
const currentSettingsHash = 'd54210758b7054e2174fd34aa2320ad7';
|
||||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||||
|
Loading…
Reference in New Issue
Block a user