Skip to content

Commit b3f7ac1

Browse files
committed
Skip running db migration on ghost install
- @todo: add tests - @todo: what about `ghost setup migrate`? [ci skip]
1 parent cf29ab0 commit b3f7ac1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/commands/setup.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class SetupCommand extends Command {
4141
const os = require('os');
4242
const url = require('url');
4343
const path = require('path');
44+
const semver = require('semver');
4445

4546
const linux = require('../tasks/linux');
4647
const migrate = require('../tasks/migrate');
@@ -81,6 +82,7 @@ class SetupCommand extends Command {
8182
});
8283

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

173175
if (argv.migrate !== false) {
176+
const instance = this.system.getInstance();
177+
174178
// Tack on db migration task to the end
175179
tasks.push({
176180
title: 'Running database migrations',
177-
task: migrate
181+
task: migrate,
182+
// CASE: We are about to install Ghost 2.0. We moved the execution of knex-migrator into Ghost.
183+
enabled: () => {
184+
if (semver.satisfies(instance.cliConfig.get('active-version'), '^2.0.0')) {
185+
return false;
186+
}
187+
188+
return true;
189+
}
178190
});
179191
}
180192

0 commit comments

Comments
 (0)