From c8fc93e9891fce272aec1be96598e4da62b2ea47 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 6 Jun 2024 16:21:19 +0100 Subject: [PATCH] Noop'ed the post_revisions.custom_excerpt population migration no issue - the query can take a very long time to run on large sites causing problems during the upgrade process - impact from not populating the column: - only has an effect when the inline excerpt beta is enabled - when beta enabled, if a revision created before the upgrade is restored then the excerpt will be removed (will be visibly empty in preview before restoring, if any edit has occurred on the post after upgrading then it can still be recovered by restoring the later version or copy/pasting from the preview) --- ...-populate-post-revisions-custom-excerpt.js | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/ghost/core/core/server/data/migrations/versions/5.84/2024-06-05-08-42-34-populate-post-revisions-custom-excerpt.js b/ghost/core/core/server/data/migrations/versions/5.84/2024-06-05-08-42-34-populate-post-revisions-custom-excerpt.js index 1986c0a1cb..e6fe2e6817 100644 --- a/ghost/core/core/server/data/migrations/versions/5.84/2024-06-05-08-42-34-populate-post-revisions-custom-excerpt.js +++ b/ghost/core/core/server/data/migrations/versions/5.84/2024-06-05-08-42-34-populate-post-revisions-custom-excerpt.js @@ -1,30 +1,9 @@ const logging = require('@tryghost/logging'); const {createTransactionalMigration} = require('../../utils'); -const DatabaseInfo = require('@tryghost/database-info'); module.exports = createTransactionalMigration( - async function up(knex) { - logging.info('Populating post_revisions.custom_excerpt with post.excerpt'); - - if (DatabaseInfo.isSQLite(knex)) { - // SQLite doesn't support JOINs in UPDATE queries - await knex.raw(` - UPDATE post_revisions - SET custom_excerpt = ( - SELECT posts.custom_excerpt - FROM posts - WHERE post_revisions.post_id = posts.id - ) - `); - } else { - await knex.raw(` - UPDATE post_revisions - JOIN posts ON post_revisions.post_id = posts.id - SET post_revisions.custom_excerpt = posts.custom_excerpt - `); - } - - logging.info('Finished populating post_revisions.custom_excerpt'); + async function up() { + logging.warn('Skipping migration - noop'); }, async function down() { // Not required