mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
refs #6301 - Replace builder & automated database upgrade with a set of explicit tasks - Ensure the tasks can only happen if they need to - Remove some duplicate code between fixture & db upgrades (more to do) - Add tests
18 lines
584 B
JavaScript
18 lines
584 B
JavaScript
var commands = require('../../schema').commands,
|
|
db = require('../../db'),
|
|
|
|
table = 'users',
|
|
column = 'tour';
|
|
|
|
module.exports = function addTourColumnToUsers(logInfo) {
|
|
return db.knex.schema.hasTable(table).then(function (exists) {
|
|
if (exists) {
|
|
return db.knex.schema.hasColumn(table, column).then(function (exists) {
|
|
if (!exists) {
|
|
logInfo('Adding column: ' + table + '.' + column);
|
|
return commands.addColumn(table, column);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|