Make Umzug an EventEmitter, add four events. #76
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The attached PR adds EventEmitter functionality to Umzug. Unit tests and documentation for four useful events are included.
Rationale: My application has some logging and consistency-checking requirements for each migration that go beyond what can be conveniently done via the
logging
option. This leads to a lot of boilerplate code in migrations, to the point where almost 50% of a typical migration is this boilerplate. This makes migrations a bit ugly to read, and it's more lifting for new team members.Using the event emitter pattern could let us eliminate this boilerplate by giving us more programmatic/event-driven insight into the individual migrations Umzug was running.