mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 06:25:51 +03:00
584bd15b76
refs #7489 - as we are now using a different migration approach (knex-migrator), we don't need to remember the database version anymore - it was once used to check the state of a database and based on it we decided to migrate or not - with knex-migrator everything depends on the migration table entries and the current ghost version you are on - on current master the leftover usage is to add the db version when exporting the database, which can be replaced by reading the ghost version - removing this solves also an interesting migration case with knex-migrator: - you are on 1.0 - you update to 1.1, but 1.1 has no migrations - the db version would remain in 1.0 - because the db version was only updated when knex migrator executed a migration
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
var testUtils = require('../utils/index'),
|
|
should = require('should'),
|
|
sinon = require('sinon'),
|
|
_ = require('lodash'),
|
|
|
|
// Stuff we are testing
|
|
exporter = require('../../server/data/export'),
|
|
utils = require('../../server/utils'),
|
|
|
|
sandbox = sinon.sandbox.create();
|
|
|
|
describe('Exporter', function () {
|
|
before(testUtils.teardown);
|
|
afterEach(testUtils.teardown);
|
|
afterEach(function () {
|
|
sandbox.restore();
|
|
});
|
|
beforeEach(testUtils.setup('default', 'settings'));
|
|
|
|
should.exist(exporter);
|
|
|
|
it('exports data', function (done) {
|
|
exporter.doExport().then(function (exportData) {
|
|
var tables = ['posts', 'users', 'roles', 'roles_users', 'permissions', 'permissions_roles',
|
|
'permissions_users', 'settings', 'tags', 'posts_tags'];
|
|
|
|
should.exist(exportData);
|
|
|
|
should.exist(exportData.meta);
|
|
should.exist(exportData.data);
|
|
|
|
exportData.meta.version.should.equal(utils.ghostVersion.full);
|
|
|
|
_.each(tables, function (name) {
|
|
should.exist(exportData.data[name]);
|
|
});
|
|
|
|
// should not export sqlite data
|
|
should.not.exist(exportData.data.sqlite_sequence);
|
|
done();
|
|
}).catch(done);
|
|
});
|
|
});
|