Skip to content

Commit

Permalink
Updated backup file names to include timestamp (#10607)
Browse files Browse the repository at this point in the history
no-issue

Currently if you run two migrations on the same day, the backup is overwritten. This change adds the `HH-mm-ss` to the file name, meaning that you get a unique backup for each migration.
  • Loading branch information
allouis committed Mar 13, 2019
1 parent 1d64090 commit 56b6c63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/server/data/exporter/index.js
Expand Up @@ -25,7 +25,7 @@ var _ = require('lodash'),
exportFileName;

exportFileName = function exportFileName(options) {
var datetime = (new Date()).toJSON().substring(0, 10),
var datetime = require('moment')().format('YYYY-MM-DD-HH-mm-ss'),
title = '';

options = options || {};
Expand Down
6 changes: 3 additions & 3 deletions core/test/unit/data/exporter/index_spec.js
Expand Up @@ -160,7 +160,7 @@ describe('Exporter', function () {
exporter.fileName().then(function (result) {
should.exist(result);
settingsStub.calledOnce.should.be.true();
result.should.match(/^testblog\.ghost\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.json$/);
result.should.match(/^testblog\.ghost\.[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}\.json$/);

done();
}).catch(done);
Expand All @@ -174,7 +174,7 @@ describe('Exporter', function () {
exporter.fileName().then(function (result) {
should.exist(result);
settingsStub.calledOnce.should.be.true();
result.should.match(/^ghost\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.json$/);
result.should.match(/^ghost\.[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}\.json$/);

done();
}).catch(done);
Expand All @@ -188,7 +188,7 @@ describe('Exporter', function () {
exporter.fileName().then(function (result) {
should.exist(result);
settingsStub.calledOnce.should.be.true();
result.should.match(/^ghost\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.json$/);
result.should.match(/^ghost\.[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}\.json$/);

done();
}).catch(done);
Expand Down

0 comments on commit 56b6c63

Please sign in to comment.