Watch your umzug migration directory and undo/redo when files change. This is intended for development mode only.
npm install --save-dev umzug-beobachten
const Umzug = require('umzug')
const watchMigrations = require('umzug-beobachten')
const umzug = new Umzug({
...
})
if (process.env.NODE_ENV !== 'production') {
const watcher = watchMigrations(umzug)
// that's it! Now if you create a migration file the watcher will
// automatically run it, and if you change a migration file, the
// watcher will undo back to before that migration, run the new version,
// and then rerun all the migrations after it.
...
// if you need to stop the watcher later without killing the process:
watcher.close()
}