mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
4f2421fac7
Closes #364 - Confirmed integration with local mysql installation works. - Updated fixtures and migration with appropriate schema-conforming values. - Updated schema with appropriate defaults and nullable columns. - Updated fixDates function on model base to appropriately deserialize values coming from SQLite now that dates are stored as actual DateTime objects/ISO strings. - Updated default language to be 'en_US'.
49 lines
No EOL
1 KiB
JavaScript
49 lines
No EOL
1 KiB
JavaScript
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; |