fix(cli): don't run any migrations if any previous migration have failed
This commit is contained in:
parent
3b36b3de52
commit
46b9104cda
2 changed files with 12 additions and 0 deletions
|
|
@ -35,6 +35,10 @@ export default async function upCommand({ directory, dry, plugins = [] }: Config
|
|||
.map((file) => file.name);
|
||||
|
||||
for await (const migrationHistoryEntry of storage.getHistory()) {
|
||||
if (migrationHistoryEntry.status === 'failed') {
|
||||
throw new Error(`Migration ${migrationHistoryEntry.name} is in a failed state, please fix it first`);
|
||||
}
|
||||
|
||||
if (migrationFiles.includes(migrationHistoryEntry.name)) {
|
||||
migrationFiles.splice(migrationFiles.indexOf(migrationHistoryEntry.name), 1);
|
||||
}
|
||||
|
|
@ -114,6 +118,9 @@ export default async function upCommand({ directory, dry, plugins = [] }: Config
|
|||
throw error;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
} finally {
|
||||
await cleanup();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue