0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/data/migration/003.js

49 lines
1 KiB
JavaScript
Raw Normal View History

var when = require('when'),
_ = require('underscore'),
knex = require('../../models/base').Knex,
migrationVersion = '003',
fixtures = require('../fixtures/' + migrationVersion),
errors = require('../../errorHandling'),
up,
down;
up = function up() {
return when.all([
knex('posts')
.whereNull('language')
.orWhere('language', 'en')
.update({
'language': 'en_US'
}),
knex('posts')
.whereNull('featured')
.update({
'featured': false
})
]).then(function incrementVersion() {
// Lastly, update the current version settings to reflect this version
return knex('settings')
.where('key', 'currentVersion')
.update({ 'value': migrationVersion });
});
};
down = function down() {
return when.all([
// No new tables as of yet, so just return a wrapped value
when(true)
]);
};
exports.up = up;
exports.down = down;