Skip to content

Commit

Permalink
Skip running db migration on ghost install
Browse files Browse the repository at this point in the history
- @todo: add tests
- @todo: what about `ghost setup migrate`?

[ci skip]
  • Loading branch information
kirrg001 committed Jul 26, 2018
1 parent cf29ab0 commit b3f7ac1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/commands/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SetupCommand extends Command {
const os = require('os');
const url = require('url');
const path = require('path');
const semver = require('semver');

const linux = require('../tasks/linux');
const migrate = require('../tasks/migrate');
Expand Down Expand Up @@ -81,6 +82,7 @@ class SetupCommand extends Command {
});

// Special-case migrations
// @TODO: how to manage ghost setup migrate in 2.0?
if (argv.stages.includes('migrate')) {
tasks.push({title: 'Running database migrations', task: migrate})
}
Expand Down Expand Up @@ -171,10 +173,20 @@ class SetupCommand extends Command {
}));

if (argv.migrate !== false) {
const instance = this.system.getInstance();

// Tack on db migration task to the end
tasks.push({
title: 'Running database migrations',
task: migrate
task: migrate,
// CASE: We are about to install Ghost 2.0. We moved the execution of knex-migrator into Ghost.
enabled: () => {
if (semver.satisfies(instance.cliConfig.get('active-version'), '^2.0.0')) {
return false;
}

return true;
}
});
}

Expand Down

0 comments on commit b3f7ac1

Please sign in to comment.