diff --git a/.changeset/eleven-files-love.md b/.changeset/eleven-files-love.md new file mode 100644 index 0000000..c4fbcd7 --- /dev/null +++ b/.changeset/eleven-files-love.md @@ -0,0 +1,5 @@ +--- +'@emigrate/types': minor +--- + +Remove the "remove" command specific reporter methods. So instead of using `onMigrationRemoveStart`, `onMigrationRemoveSuccess` and `onMigrationRemoveError` the `onMigrationStart`, `onMigrationSuccess` and `onMigrationError` methods should be used and the reporter can still format the output differently depending on the current command (which it receives in the `onInit` method). This is a BREAKING CHANGE. diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 89a546a..9461bd9 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -272,36 +272,20 @@ export type EmigrateReporter = Partial<{ * This is only called when the command is 'new'. */ onNewMigration(migration: MigrationMetadata, content: string): Awaitable; - /** - * Called when a migration is about to be removed from the migration history. - * - * This is only called when the command is 'remove'. - */ - onMigrationRemoveStart(migration: MigrationMetadata): Awaitable; - /** - * Called when a migration is successfully removed from the migration history. - * - * This is only called when the command is 'remove'. - */ - onMigrationRemoveSuccess(migration: SuccessfulMigrationMetadata): Awaitable; - /** - * Called when a migration couldn't be removed from the migration history. - * - * This is only called when the command is 'remove'. - */ - onMigrationRemoveError(migration: FailedMigrationMetadata, error: Error): Awaitable; /** * Called when a migration is about to be executed. * - * Will only be called for each migration when the command is "up". + * Will be called for each migration when the command is "up", + * or before removing each migration from the history when the command is "remove". * - * @param migration Information about the migration that is about to be executed. + * @param migration Information about the migration that is about to be executed/removed. */ onMigrationStart(migration: MigrationMetadata): Awaitable; /** * Called when a migration has been successfully executed. * - * Will be called after a successful migration when the command is "up" + * Will be called after a successful migration when the command is "up", + * or after a successful removal of a migration from the history when the command is "remove", * or for each successful migration from the history when the command is "list". * * @param migration Information about the migration that was executed. @@ -310,7 +294,8 @@ export type EmigrateReporter = Partial<{ /** * Called when a migration has failed. * - * Will be called after a failed migration when the command is "up" + * Will be called after a failed migration when the command is "up", + * or after a failed removal of a migration from the history when the command is "remove", * or for each failed migration from the history when the command is "list" (will be at most one in this case). * * @param migration Information about the migration that failed.