0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Updated backup file names to include timestamp (#10607)

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.
This commit is contained in:
Fabien O'Carroll 2019-03-13 21:06:05 +01:00 committed by GitHub
parent 1d64090f5e
commit 56b6c633f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -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 || {};

View file

@ -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);
@ -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);
@ -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);