0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/data/schema/bootup.js
Hannah Wolfe 9a520f39fb 🎨 Preparation for going alpha (#7404)
- Don't let people start Ghost Alpha with non-alpha databases.
- Provide a new welcome message for development mode (a little bit of positive reinforcment)
- Provide a RED WARNING when in production mode (will still be used for developing, but we can ignore)
- Change package.json to 1.0.0-alpha.0, we won't relelase this, will bump to .1 for release
2016-09-20 15:59:34 +01:00

27 lines
1.1 KiB
JavaScript

var Promise = require('bluebird'),
versioning = require('./versioning'),
migrations = require('../migration'),
errors = require('./../../errors');
module.exports = function bootUp() {
return versioning
.getDatabaseVersion()
.then(function successHandler(result) {
if (!/^alpha/.test(result)) {
// This database was not created with Ghost alpha, and is not compatible
throw new errors.DatabaseVersion(
'Your database version is not compatible with Ghost 1.0.0 Alpha (master branch)',
'Want to keep your DB? Use Ghost < 1.0.0 or the "stable" branch. Otherwise please delete your DB and restart Ghost',
'More information on the Ghost 1.0.0 Alpha at https://support.ghost.org/v1-0-alpha'
);
}
},
// We don't use .catch here, as it would catch the error from the successHandler
function errorHandler(err) {
if (err instanceof errors.DatabaseNotPopulated) {
return migrations.populate();
}
return Promise.reject(err);
});
};