no need for a special test setup handling in the migration script
This commit is contained in:
@@ -4,22 +4,6 @@ var async = require('async'),
|
|||||||
safe = require('safetydance');
|
safe = require('safetydance');
|
||||||
|
|
||||||
exports.up = function(db, callback) {
|
exports.up = function(db, callback) {
|
||||||
function prepareTestSetupIfNeeded(done) {
|
|
||||||
if (process.env.BOX_ENV !== 'test') return done();
|
|
||||||
|
|
||||||
const settings = [
|
|
||||||
[ 'domain', JSON.stringify({ fqdn: 'example.com', zoneName: 'example.com' })],
|
|
||||||
[ 'dns_config', JSON.stringify({ provider: 'manual', wildcard: true })]
|
|
||||||
];
|
|
||||||
|
|
||||||
async.eachSeries(settings, function (setting, callback) {
|
|
||||||
db.runSql('INSERT INTO settings (name, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value=VALUES(value)', setting, callback);
|
|
||||||
}, done);
|
|
||||||
}
|
|
||||||
|
|
||||||
prepareTestSetupIfNeeded(function (error) {
|
|
||||||
if (error) return callback(error);
|
|
||||||
|
|
||||||
// first check precondtion of domain entry in settings
|
// first check precondtion of domain entry in settings
|
||||||
db.all('SELECT * FROM settings WHERE name = ?', [ 'domain' ], function (error, result) {
|
db.all('SELECT * FROM settings WHERE name = ?', [ 'domain' ], function (error, result) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
@@ -52,10 +36,12 @@ exports.up = function(db, callback) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
function addMailboxesDomainColumn(done) {
|
function addMailboxesDomainColumn(done) {
|
||||||
|
console.log('add mailboxes domain')
|
||||||
db.runSql('ALTER TABLE mailboxes ADD COLUMN domain VARCHAR(128)', [], done);
|
db.runSql('ALTER TABLE mailboxes ADD COLUMN domain VARCHAR(128)', [], done);
|
||||||
},
|
},
|
||||||
function setMailboxesDomain(done) {
|
function setMailboxesDomain(done) {
|
||||||
if (!domain.fqdn) return done(); // skip for new cloudrons without a domain
|
if (!domain.fqdn) return done(); // skip for new cloudrons without a domain
|
||||||
|
console.log('update mailboxes domain')
|
||||||
db.runSql('UPDATE mailboxes SET domain = ?', [ domain.fqdn ], done);
|
db.runSql('UPDATE mailboxes SET domain = ?', [ domain.fqdn ], done);
|
||||||
},
|
},
|
||||||
function dropAppsLocationUniqueConstraint(done) {
|
function dropAppsLocationUniqueConstraint(done) {
|
||||||
@@ -64,7 +50,6 @@ exports.up = function(db, callback) {
|
|||||||
db.runSql.bind(db, 'COMMIT')
|
db.runSql.bind(db, 'COMMIT')
|
||||||
], callback);
|
], callback);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.down = function(db, callback) {
|
exports.down = function(db, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user