mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
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:
parent
16a0bf66fd
commit
c8fc93e989
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user