Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added migration and schema change for posts_meta.hide_title_and_feature_image #17187

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ module.exports = async (model, frame, options) => {
delete jsonModel.email_only;
delete jsonModel.newsletter_id;

// TODO: remove this once full API support is in place
delete jsonModel.hide_title_and_feature_image;

return jsonModel;
};
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ const post = (attrs, frame) => {
delete attrs.primary_author;
}

if (attrs.type !== 'page') {
delete attrs.hide_title_and_feature_image;
}

delete attrs.locale;
delete attrs.author;
delete attrs.type;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const {createAddColumnMigration} = require('../../utils');

module.exports = createAddColumnMigration('posts_meta', 'hide_title_and_feature_image', {
type: 'boolean',
nullable: false,
defaultTo: false
});
3 changes: 2 additions & 1 deletion ghost/core/core/server/data/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ module.exports = {
frontmatter: {type: 'text', maxlength: 65535, nullable: true},
feature_image_alt: {type: 'string', maxlength: 191, nullable: true, validations: {isLength: {max: 125}}},
feature_image_caption: {type: 'text', maxlength: 65535, nullable: true},
email_only: {type: 'boolean', nullable: false, defaultTo: false}
email_only: {type: 'boolean', nullable: false, defaultTo: false},
hide_title_and_feature_image: {type: 'boolean', nullable: false, defaultTo: false}
},
// NOTE: this is the staff table
users: {
Expand Down
3 changes: 2 additions & 1 deletion ghost/core/core/server/models/posts-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const PostsMeta = ghostBookshelf.Model.extend({

defaults: function defaults() {
return {
email_only: false
email_only: false,
hide_title_and_feature_image: false
};
},

Expand Down
2 changes: 1 addition & 1 deletion ghost/core/test/unit/server/data/schema/integrity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '66549146e850f0e86ca052a4f53fa811';
const currentSchemaHash = 'ffd6d6cc850ffa0f69c6a08014e51bf9';
const currentFixturesHash = '93c3b3cb8bca34a733634e74ee514172';
const currentSettingsHash = '4f23a583335dcb4cb3fae553122ea200';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
Expand Down