mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added suppressions table and model
refs https://github.com/TryGhost/Team/issues/2317 This table is used for persisting the email suppression list. We don't have a member_id column because emails, not members are suppressed.
This commit is contained in:
parent
f5045b9bf7
commit
83be54af42
6 changed files with 46 additions and 2 deletions
|
@ -43,7 +43,8 @@ const BACKUP_TABLES = [
|
|||
'jobs',
|
||||
'redirects',
|
||||
'members_click_events',
|
||||
'members_feedback'
|
||||
'members_feedback',
|
||||
'suppressions'
|
||||
];
|
||||
|
||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
const {addTable} = require('../../utils');
|
||||
|
||||
module.exports = addTable('suppressions', {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
email_address: {type: 'string', maxlength: 191, nullable: false, unique: true},
|
||||
email_id: {type: 'string', maxlength: 24, nullable: true, references: 'emails.id'},
|
||||
reason: {type: 'string', maxlength: 50, nullable: false},
|
||||
created_at: {type: 'dateTime', nullable: false}
|
||||
});
|
|
@ -949,5 +949,22 @@ module.exports = {
|
|||
post_id: {type: 'string', maxlength: 24, nullable: false, references: 'posts.id', cascadeDelete: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
},
|
||||
suppressions: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
email_address: {type: 'string', maxlength: 191, nullable: false, unique: true, validations: {isEmail: true}},
|
||||
email_id: {type: 'string', maxlength: 24, nullable: true, references: 'emails.id'},
|
||||
reason: {
|
||||
type: 'string',
|
||||
maxlength: 50,
|
||||
nullable: false,
|
||||
validations: {
|
||||
isIn: [[
|
||||
'spam',
|
||||
'bounce'
|
||||
]]
|
||||
}
|
||||
},
|
||||
created_at: {type: 'dateTime', nullable: false}
|
||||
}
|
||||
};
|
||||
|
|
9
ghost/core/core/server/models/suppression.js
Normal file
9
ghost/core/core/server/models/suppression.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const ghostBookshelf = require('./base');
|
||||
|
||||
const Suppression = ghostBookshelf.Model.extend({
|
||||
tableName: 'suppressions'
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
Suppression: ghostBookshelf.model('Suppression', Suppression)
|
||||
};
|
|
@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
|
|||
*/
|
||||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = '4b749aee6b3c823c3ea27e2c936cde17';
|
||||
const currentSchemaHash = 'ded409c0ead434761073836b8b6975c6';
|
||||
const currentFixturesHash = 'dcb7ba7c66b4b98d6c26a722985e756a';
|
||||
const currentSettingsHash = '9acce72858e75420b831297718595bbd';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
|
8
ghost/core/test/unit/server/models/suppression.test.js
Normal file
8
ghost/core/test/unit/server/models/suppression.test.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const assert = require('assert');
|
||||
const Suppression = require('../../../../core/server/models/suppression');
|
||||
|
||||
describe('Suppression', function () {
|
||||
it('exists', function () {
|
||||
assert(Suppression);
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue