Use isSilent flag in SQL migration templates #805
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.
Previously setting the db-migrate instance isSilent flag did not prevent the printing of the SQL migration files. This caused a huge amount of noise in the output and there was no way to prevent this when calling the up()-function. If you wanted to prevent logging, you would either have to disable those completely by removing the console.log calls, implement your own logic for the logging or do what I did in this PR i.e. modify the code in the template to only log the SQL if the isSilent flag is not set.
Although it would be better to have the log function available also in the migration scripts in order to better control the amount of logging, AFAICT doing so would need a larger change. I'm sure many users would still appreciate having even the use of isSilent in the templates by default.