diff --git a/ghost/core/core/server/data/migrations/versions/5.24/2022-11-21-15-03-populate-source-column-with-html-for-emails.js b/ghost/core/core/server/data/migrations/versions/5.24/2022-11-21-15-03-populate-source-column-with-html-for-emails.js new file mode 100644 index 0000000000..5e2443b66c --- /dev/null +++ b/ghost/core/core/server/data/migrations/versions/5.24/2022-11-21-15-03-populate-source-column-with-html-for-emails.js @@ -0,0 +1,19 @@ +const logging = require('@tryghost/logging'); +const {createTransactionalMigration} = require('../../utils'); + +module.exports = createTransactionalMigration( + async function up(knex) { + logging.info('Populating source from html in emails table'); + + const affectedRows = await knex('emails') + .update({ + source: knex.ref('html') + }); + + logging.info(`Updated ${affectedRows} rows with source html data`); + }, + + async function down() { + // no-op: we don't want to remove the data + } +);