sequelize / umzug

Framework agnostic migration tool for Node.js
MIT License
1.98k stars 158 forks source link

Logging inside a migration script #650

Closed redevill closed 4 months ago

redevill commented 4 months ago

Immediate issue:

Umzug V3 Running in a Typescript compiled environment using Node V18.19.0 Would like to add logging statements to a migration script. I have tried a couple of different loggers (Log4js/Winston/Console), logging to console and to files, but not sure what I am missing, but getting nothing from the "up" function context. I have the umzug setup -> logger: console. Log statements in the rest of the code do just fine.

module.exports = { up: async (queryInterface, Sequelize) => { log.info('custom message desired here')}; It would be nice to be able to log - any help would be appreciated. TIA


Background:

Above logging is needed to help diagnose sequencing issue with DDL statements:

  1. check for constraint
  2. remove constraint if exists
  3. create new improved constraint

Constraint removal always seems to happen last - regardless of my promise chain.?!?!

redevill commented 4 months ago

It certainly helps if you are debugging the correct file - sorry guys, egg on my face.