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)
This commit is contained in:
Kevin Ansfield 2024-06-06 16:21:19 +01:00
parent 16a0bf66fd
commit c8fc93e989

View File

@ -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