Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
/ umzug-beobachten Public archive

watch your umzug migration directory and undo/redo when files change

License

Notifications You must be signed in to change notification settings

jcoreio/umzug-beobachten

Repository files navigation

umzug-beobachten

Build Status Coverage Status semantic-release Commitizen friendly

Watch your umzug migration directory and undo/redo when files change. This is intended for development mode only.

Installation

npm install --save-dev umzug-beobachten

Usage

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()
}