0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Populated email table source with existing html data

refs https://github.com/TryGhost/Team/issues/2280

- updates `source` value for all existing rows to contain `html` data for future compatibility with new columns
This commit is contained in:
Rishabh 2022-11-23 13:21:07 +05:30 committed by Rishabh Garg
parent 5780fc2a93
commit 9b0c21e0a2

View file

@ -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
}
);