2016-08-30 22:15:13 -07:00
|
|
|
var dbm = global.dbm || require('db-migrate');
|
|
|
|
|
var type = dbm.dataType;
|
|
|
|
|
|
|
|
|
|
exports.up = function(db, callback) {
|
2016-08-31 06:30:50 -07:00
|
|
|
db.all('SELECT id FROM users', function (error, results) {
|
|
|
|
|
if (error) return callback(error);
|
2016-08-31 05:33:44 -07:00
|
|
|
|
|
|
|
|
// existing cloudrons have email enabled by default. future cloudrons will have it disabled by default
|
|
|
|
|
var enable = results.length !== 0;
|
|
|
|
|
db.runSql('INSERT settings (name, value) VALUES("mail_config", ?)', [ JSON.stringify({ enabled: enable }) ], callback);
|
|
|
|
|
});
|
2016-08-30 22:15:13 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.down = function(db, callback) {
|
|
|
|
|
db.runSql('DELETE * FROM settings WHERE name="mail_config"', [ ], callback);
|
|
|
|
|
};
|
|
|
|
|
|