db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 361 forks source link

Use isSilent flag in SQL migration templates #805

Open gadgetmies opened 1 year ago

gadgetmies commented 1 year ago

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.