# sequelize-migration-wrapper

> A wrapper for migrating databases using Sequelize and Umzug.

Latest version **2.0.0** (published 2025-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install sequelize-migration-wrapper
pnpm add sequelize-migration-wrapper
yarn add sequelize-migration-wrapper
bun add sequelize-migration-wrapper
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-12-05 |
| First published | 2019-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alex Seifert |
| Maintainers | eiskalteschatten |
| Keywords | sequelize, migration, umzug, database, mysql, postgresql, sqlite, sql |

## Links

- npm: https://www.npmjs.com/package/sequelize-migration-wrapper
- Repository: https://github.com/eiskalteschatten/sequelize-migration-wrapper
- Homepage: https://github.com/eiskalteschatten/sequelize-migration-wrapper#readme
- Issues: https://github.com/eiskalteschatten/sequelize-migration-wrapper/issues
- npm.io page: https://npm.io/package/sequelize-migration-wrapper

## Dependencies (1)

- [umzug](https://npm.io/package/umzug.md) ^3.8.2

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-12-05
- 1.0.1 — 2021-05-17
- 1.0.0 — 2020-08-28
- 0.1.1 — 2019-08-07
- 0.1.0 — 2019-04-08

## README

# sequelize-migration-wrapper

> A wrapper for migrating databases using Sequelize and Umzug.


## Table of Contents

- <a href="#requirements">Requirements</a>
- <a href="#install">Install</a>
- <a href="#usage">Usage</a>
- <a href="#api">API</a>
- <a href="#release-notes">Release Notes</a>
- <a href="#maintainer">Maintainer</a>


## Requirements

This module is tested with Node.js 14. It might work with Node.js >= 12, but is not tested.


## Install

```
npm install --save sequelize-migration-wrapper
```

## Usage

### Initialization

```js
import { setupMigration } from 'sequelize-migration-wrapper'; // TypeScript
const { setupMigration } = require('sequelize-migration-wrapper'); // CommonJS

const sequelize = new Sequelize({...});

setupMigration({
  sequelize,
  glob: 'path/to/migration/scripts/*.{js,ts}',
});
```

#### Options

- sequelize (no default, must be a Sequelize instance; required),
- glob (no default; required),


## API

### migrate()

Runs through all migration scripts in the configured folder. Umzug automatically saves which migration scripts have already been run, so it will not re-run those.

```js
await migrateDb.migrate();
```

### getStatus()

Get the current status of the migration

```js
const status = await migrateDb.getStatus();
```

### migrateNext()

Iteratively run through migration scripts.

```js
for (const i in numberOfScriptsOrSomething) {
  await migrateDb.migrateNext();
}
```

### reset()

Undo the last migration using Umzug's `down` function. This will only work if your migration scripts provide a `down` function. See [Umzug's documentation](https://github.com/sequelize/umzug#migrations) for more details.

```js
await migrateDb.reset();
```

### resetPrev()

Iteratively undo a migration. This will only work if your migration scripts provide a `down` function. See [Umzug's documentation](https://github.com/sequelize/umzug#migrations) for more details.

```js
for (const i in numberOfScriptsOrSomething) {
  await migrateDb.resetPrev();
}
```


## Release Notes

### 2.0.0

- Major update for `umzug`
- **Breaking Change:** a glob is now required instead of the `path`/`filePattern` combination
- Security updates

### 1.0.1

- Security updates


### 1.0.0

- Complete rewrite in TypeScript
- Support for Sequelize 6

### 0.1.1

- Update dependencies to fix security vulnerabilities

### 0.1.0

- Initial release


## Maintainer

This modules is maintained by Alex Seifert ([Website](https://www.alexseifert.com), [Github](https://github.com/eiskalteschatten)).

---
_Source: https://npm.io/package/sequelize-migration-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
