Umzug
Framework-agnostic migration library that tracks applied migrations in any storage and runs up and down operations.
Official Documentation ↗v3. Check the official docs for the latest API surface.Installation
npm install umzugpnpm add umzugMethods
No methods match this filter.
Overview
Umzug is a framework-agnostic migration runner that tracks applied migrations in pluggable storage and executes up and down operations. This reference lists the most frequently used APIs with accurate signatures and runnable snippets.
Core APIs
new Umzug— Creates a migration runner given migration sources, a storage adapter, and an optional context.umzug.up— Applies all pending migrations and resolves with the migrations that ran.umzug.down— Reverts the last applied migration, or a specified step or migration name.
Example
const { Umzug, SequelizeStorage } = require('umzug');
const umzug = new Umzug({
migrations: { glob: 'migrations/*.js' },
context: sequelize.getQueryInterface(),
storage: new SequelizeStorage({ sequelize }),
});
Notes
Umzug stores no state itself; correctness depends on the storage adapter recording each applied migration exactly once.
Verification
Run up, confirm the storage table lists the new migration, then run down and confirm its row is removed.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/sequelize/umzug@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:53:13.722Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- The constructor option logging is replaced by logger to allow for warn and error messages in future. (https://cdn.jsdelivr.net/gh/sequelize/umzug@latest/README.md)
- Note that the error will be thrown and no migrations run unless all migration names are found - whether or not rerun: ‘ALLOW’ is added. (https://cdn.jsdelivr.net/gh/sequelize/umzug@latest/README.md)
- Note: this will always run, even if the command throws an error. (https://cdn.jsdelivr.net/gh/sequelize/umzug@latest/README.md)
FAQ
- Where does Umzug record applied migrations?
- In the storage adapter you pass; SequelizeStorage uses a table, and custom storage can use files or any datastore.
- Can Umzug run without Sequelize?
- Yes. Umzug is framework-agnostic; the context is any object your migration functions receive, and storage is pluggable.
- How do I migrate only up to a version?
- Call umzug.up({ to: "migration-name" }) to stop after the named migration.
Report a problem with this API docOpens a pre-filled issue on GitHub.