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.
This builds on #6621 and ended up being a little more involved than I had originally intended. To start with I just added a flag to logInfo so that it would output the message differently - but the code was instantly harder to read and the tests became very hard to reason about.
Plus, I know, really, we need to move towards having proper 'loggers' as per #2001 and this uses the right sort of pattern.
So.. instead of passing a single
logInfo
method around the migration system, we now pass around alogger
object which has aninfo
and awarn
method. They do similar things - prefixing a message with either 'Migrations:' or 'Skipping Migrations:' and adding a colour. The normal message is blue, the warning is yellow.Everywhere in the data & fixture migrations where a migration is skipped over, a warning message is now being output.
So, if I run a simple 003->004 migration, I get output like this, where you can see I didn't have any badly formed tags:
And then if I use
FORCE_MIGRATION=true npm start
to get the migrations to run a second time, I get this:And we can easily see that none of the migrations actually ran.
The aim here is just to make debugging easier & make things a little more explicit and clear. Hopefully we'll reap the benefits later 😁
refs #6301
logInfo
tologger
that has both an info and a warn method