0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added author & title to post revisions (#16649)

no issue

Added `created_by` and `title` columns to `post_revisions` table
This commit is contained in:
Michael Barrett 2023-04-18 11:47:57 +01:00 committed by GitHub
parent ba5fb35e36
commit 75e6ce261c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 3 deletions

View file

@ -0,0 +1,21 @@
const {combineNonTransactionalMigrations,createAddColumnMigration} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('post_revisions', 'author_id', {
type: 'string',
maxlength: 2000,
nullable: true,
references: 'users.id',
cascadeDelete: false
}),
createAddColumnMigration('post_revisions', 'title', {
type: 'string',
maxlength: 24,
nullable: true,
validations: {
isLength: {
max: 255
}
}
})
);

View file

@ -402,7 +402,9 @@ module.exports = {
post_id: {type: 'string', maxlength: 24, nullable: false, index: true},
lexical: {type: 'text', maxlength: 1000000000, fieldtype: 'long', nullable: true},
created_at_ts: {type: 'bigInteger', nullable: false},
created_at: {type: 'dateTime', nullable: false}
created_at: {type: 'dateTime', nullable: false},
author_id: {type: 'string', maxlength: 24, nullable: true, references: 'users.id', cascadeDelete: false},
title: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 255}}}
},
members: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},

View file

@ -693,11 +693,13 @@ Object {
"og_title": null,
"post_revisions": Array [
Object {
"author_id": null,
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"created_at_ts": Any<Number>,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"lexical": "{\\"root\\":{\\"children\\":[{\\"children\\":[{\\"detail\\":0,\\"format\\":0,\\"mode\\":\\"normal\\",\\"style\\":\\"\\",\\"text\\":\\"Testing post creation with lexical\\",\\"type\\":\\"text\\",\\"version\\":1}],\\"direction\\":\\"ltr\\",\\"format\\":\\"\\",\\"indent\\":0,\\"type\\":\\"paragraph\\",\\"version\\":1}],\\"direction\\":\\"ltr\\",\\"format\\":\\"\\",\\"indent\\":0,\\"type\\":\\"root\\",\\"version\\":1}}",
"post_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"title": null,
},
],
"published_at": null,
@ -720,7 +722,7 @@ exports[`Posts API Can read with post_revisions included 4: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "1450",
"content-length": "1480",
"content-type": "application/json; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,

View file

@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '8ec1f25b5e9e1dde5b1b8ee04dacf4f9';
const currentSchemaHash = '67f4d03c5b49faccb9aceb127311c5c6';
const currentFixturesHash = '869ceb3302303494c645f4201540ead3';
const currentSettingsHash = 'e2fc04c37fe89e972b063ee8fd1d4bec';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';