We use only mysql, so updating this means a lot of unused db backends like sqlite do not need to be built with gyp anymore. Note that this version is not yet released as stable, but works fine for us. The outstanding issues are not related to our use-case from what I can tell. Fixes #82
27 lines
746 B
JavaScript
27 lines
746 B
JavaScript
'use strict';
|
|
|
|
var async = require('async');
|
|
|
|
// imports mailbox entries for existing users
|
|
exports.up = function(db, callback) {
|
|
async.series([
|
|
db.runSql.bind(db, 'START TRANSACTION;'),
|
|
function addUserMailboxes(done) {
|
|
db.all('SELECT username FROM users', function (error, results) {
|
|
if (error) return done(error);
|
|
|
|
async.eachSeries(results, function (r, next) {
|
|
if (!r.username) return next();
|
|
|
|
db.runSql('INSERT INTO mailboxes (name) VALUES (?)', [ r.username ], next);
|
|
}, done);
|
|
});
|
|
},
|
|
db.runSql.bind(db, 'COMMIT')
|
|
], callback);
|
|
};
|
|
|
|
exports.down = function(db, callback) {
|
|
callback();
|
|
};
|