diff --git a/src/database.js b/src/database.js index 50c8b50d7..d6c1e6b0e 100644 --- a/src/database.js +++ b/src/database.js @@ -146,9 +146,9 @@ async function exportToFile(file) { // latest mysqldump enables column stats by default which is not present in MySQL 5.7 server // this option must not be set in production cloudrons which still use the old mysqldump - const disableColStats = (constants.TEST && require('fs').readFileSync('/etc/lsb-release', 'utf-8').includes('20.04')) ? '--column-statistics=0' : ''; + const colStats = (!constants.TEST && require('fs').readFileSync('/etc/lsb-release', 'utf-8').includes('20.04')) ? '--column-statistics=0' : ''; - const cmd = `/usr/bin/mysqldump -h "${gDatabase.hostname}" -u root -p${gDatabase.password} ${disableColStats} --single-transaction --routines --triggers ${gDatabase.name} > "${file}"`; + const cmd = `/usr/bin/mysqldump -h "${gDatabase.hostname}" -u root -p${gDatabase.password} ${colStats} --single-transaction --routines --triggers ${gDatabase.name} > "${file}"`; const [error] = await safe(shell.promises.exec('exportToFile', cmd)); if (error) throw new BoxError(BoxError.DATABASE_ERROR, error); diff --git a/src/test/database-test.js b/src/test/database-test.js index 6f449e62b..decd8a577 100644 --- a/src/test/database-test.js +++ b/src/test/database-test.js @@ -36,16 +36,10 @@ describe('database', function () { }); it('can export to file', async function () { - // arch only has maria db which lacks some mysqldump options we need, this is only here to allow running the tests :-/ - if (!fs.readFileSync('/etc/lsb-release', 'utf8').includes('Ubuntu')) return; - await database.exportToFile('/tmp/box.mysqldump'); }); it('can import from file', async function () { - // arch only has maria db which lacks some mysqldump options we need, this is only here to allow running the tests :-/ - if (!fs.readFileSync('/etc/lsb-release', 'utf8').includes('Ubuntu')) return; - await database.importFromFile('/tmp/box.mysqldump'); }); });