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:
parent
5780fc2a93
commit
9b0c21e0a2
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
);
|
Loading…
Add table
Reference in a new issue