feat(remove): implement the "remove" command for removing migrations from the history
This commit is contained in:
parent
9447d28ad8
commit
d8a6a2428a
12 changed files with 370 additions and 24 deletions
|
|
@ -193,7 +193,7 @@ const getSummary = (
|
|||
|
||||
const statusLine = [
|
||||
failed ? red.bold(`${failed} failed`) : '',
|
||||
done ? green.bold(`${done} ${command === 'new' ? 'created' : 'done'}`) : '',
|
||||
done ? green.bold(`${done} ${command === 'new' ? 'created' : command === 'remove' ? 'removed' : 'done'}`) : '',
|
||||
skipped ? yellow.bold(`${skipped} skipped`) : '',
|
||||
pending ? cyan.bold(`${pending} pending`) : '',
|
||||
]
|
||||
|
|
@ -267,6 +267,19 @@ class DefaultFancyReporter implements Required<EmigrateReporter> {
|
|||
this.#migrations = [migration];
|
||||
}
|
||||
|
||||
onMigrationRemoveStart(migration: MigrationMetadata): Awaitable<void> {
|
||||
this.#migrations = [migration];
|
||||
this.#activeMigration = migration;
|
||||
}
|
||||
|
||||
onMigrationRemoveSuccess(migration: MigrationMetadataFinished): Awaitable<void> {
|
||||
this.#finishMigration(migration);
|
||||
}
|
||||
|
||||
onMigrationRemoveError(migration: MigrationMetadataFinished, _error: Error): Awaitable<void> {
|
||||
this.#finishMigration(migration);
|
||||
}
|
||||
|
||||
onMigrationStart(migration: MigrationMetadata): void | PromiseLike<void> {
|
||||
this.#activeMigration = migration;
|
||||
}
|
||||
|
|
@ -372,6 +385,18 @@ class DefaultReporter implements Required<EmigrateReporter> {
|
|||
console.log(getMigrationText(migration));
|
||||
}
|
||||
|
||||
onMigrationRemoveStart(migration: MigrationMetadata): Awaitable<void> {
|
||||
console.log(getMigrationText(migration));
|
||||
}
|
||||
|
||||
onMigrationRemoveSuccess(migration: MigrationMetadataFinished): Awaitable<void> {
|
||||
console.log(getMigrationText(migration));
|
||||
}
|
||||
|
||||
onMigrationRemoveError(migration: MigrationMetadataFinished, _error: Error): Awaitable<void> {
|
||||
console.error(getMigrationText(migration));
|
||||
}
|
||||
|
||||
onMigrationStart(migration: MigrationMetadata): void | PromiseLike<void> {
|
||||
console.log(getMigrationText(migration, migration));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue