mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added email_recipient_filter column to posts table
no-issue This column will allow us to decouple the recipients of newsletter from the `visibility` of a post, allowing us to send emails to specifically free members, or to send paid posts as newsletters to all members.
This commit is contained in:
parent
9b45ea6f7d
commit
3b0a84b33b
4 changed files with 35 additions and 2 deletions
|
@ -0,0 +1,25 @@
|
||||||
|
const {createColumnMigration, addColumn, dropColumn} = require('../../../schema/commands');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: createColumnMigration({
|
||||||
|
table: 'posts',
|
||||||
|
column: 'email_recipient_filter',
|
||||||
|
dbIsInCorrectState: hasColumn => !!hasColumn,
|
||||||
|
operation: addColumn,
|
||||||
|
operationVerb: 'Adding',
|
||||||
|
columnDefinition: {
|
||||||
|
type: 'string',
|
||||||
|
maxlength: 50,
|
||||||
|
nullable: false,
|
||||||
|
defaultTo: 'none',
|
||||||
|
validations: {isIn: [['none', 'all', 'free', 'paid']]}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
down: createColumnMigration({
|
||||||
|
table: 'posts',
|
||||||
|
column: 'email_recipient_filter',
|
||||||
|
dbIsInCorrectState: hasColumn => !hasColumn,
|
||||||
|
operation: dropColumn,
|
||||||
|
operationVerb: 'Removing'
|
||||||
|
})
|
||||||
|
};
|
|
@ -30,6 +30,13 @@ module.exports = {
|
||||||
validations: {isIn: [['public', 'members', 'paid']]}
|
validations: {isIn: [['public', 'members', 'paid']]}
|
||||||
},
|
},
|
||||||
send_email_when_published: {type: 'bool', nullable: true, defaultTo: false},
|
send_email_when_published: {type: 'bool', nullable: true, defaultTo: false},
|
||||||
|
email_recipient_filter: {
|
||||||
|
type: 'string',
|
||||||
|
maxlength: 50,
|
||||||
|
nullable: false,
|
||||||
|
defaultTo: 'none',
|
||||||
|
validations: {isIn: [['none', 'all', 'free', 'paid']]}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* @deprecated: `author_id`, might be removed in Ghost 3.0
|
* @deprecated: `author_id`, might be removed in Ghost 3.0
|
||||||
* If we keep it, then only, because you can easier query post.author_id than posts_authors[*].sort_order.
|
* If we keep it, then only, because you can easier query post.author_id than posts_authors[*].sort_order.
|
||||||
|
|
|
@ -55,7 +55,8 @@ Post = ghostBookshelf.Model.extend({
|
||||||
status: 'draft',
|
status: 'draft',
|
||||||
featured: false,
|
featured: false,
|
||||||
type: 'post',
|
type: 'post',
|
||||||
visibility: visibility
|
visibility: visibility,
|
||||||
|
email_recipient_filter: 'none'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ const defaultSettings = require('../../../../core/server/data/schema/default-set
|
||||||
*/
|
*/
|
||||||
describe('DB version integrity', function () {
|
describe('DB version integrity', function () {
|
||||||
// Only these variables should need updating
|
// Only these variables should need updating
|
||||||
const currentSchemaHash = 'c4de64f1c1114eb8b05c7473e3adc29e';
|
const currentSchemaHash = '7d841714b01e6d880d4d8a739ab62bff';
|
||||||
const currentFixturesHash = 'd46d696c94d03e41a5903500547fea77';
|
const currentFixturesHash = 'd46d696c94d03e41a5903500547fea77';
|
||||||
const currentSettingsHash = 'c8daa2c9632bb75f9d60655de09ae3bd';
|
const currentSettingsHash = 'c8daa2c9632bb75f9d60655de09ae3bd';
|
||||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||||
|
|
Loading…
Add table
Reference in a new issue