mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Ensured that the page column can be rolled back
refs #10922 When rolling back the removal of the page column, we must re-add it, but the definition for it has been removed from the schema, so we must hardcode the definition.
This commit is contained in:
parent
1096dc2085
commit
b45e955dea
1 changed files with 8 additions and 3 deletions
|
@ -3,7 +3,7 @@ const commands = require('../../../schema').commands;
|
|||
|
||||
const createLog = type => msg => common.logging[type](msg);
|
||||
|
||||
function createColumnMigration({table, column, dbIsInCorrectState, operation, operationVerb}) {
|
||||
function createColumnMigration({table, column, dbIsInCorrectState, operation, operationVerb, columnDefinition}) {
|
||||
return function columnMigrations({transacting}) {
|
||||
return transacting.schema.hasColumn(table, column)
|
||||
.then(dbIsInCorrectState)
|
||||
|
@ -13,7 +13,7 @@ function createColumnMigration({table, column, dbIsInCorrectState, operation, op
|
|||
log(`${operationVerb} ${table}.${column}`);
|
||||
|
||||
if (!isInCorrectState) {
|
||||
return operation(table, column, transacting);
|
||||
return operation(table, column, transacting, columnDefinition);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -36,7 +36,12 @@ module.exports.down = createColumnMigration({
|
|||
return columnExists === true;
|
||||
},
|
||||
operation: commands.addColumn,
|
||||
operationVerb: 'Adding'
|
||||
operationVerb: 'Adding',
|
||||
columnDefinition: {
|
||||
type: 'bool',
|
||||
nullable: false,
|
||||
defaultTo: false
|
||||
}
|
||||
});
|
||||
|
||||
module.exports.config = {
|
||||
|
|
Loading…
Reference in a new issue