# @emigrate/cli

> Emigrate is a tool for managing database migrations. It is designed to be simple yet support advanced setups, modular and extensible.

Latest version **1.0.0** (published 2025-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @emigrate/cli
pnpm add @emigrate/cli
yarn add @emigrate/cli
bun add @emigrate/cli
```

Provides the command `emigrate`.

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2025-11-20 |
| First published | 2023-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 14 |
| Unpacked size | 352.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Aboviq AB |
| Maintainers | joakimbeng |
| Keywords | migrate, migrations, database, emigrate, immigration |

## Links

- npm: https://www.npmjs.com/package/@emigrate/cli
- Repository: https://github.com/aboviq/emigrate.git#main
- Homepage: https://github.com/aboviq/emigrate/tree/main/packages/cli#readme
- Issues: https://github.com/aboviq/emigrate/issues
- npm.io page: https://npm.io/package/@emigrate/cli

## Dependencies (14)

- [figures](https://npm.io/package/figures.md) 6.0.1
- [pretty-ms](https://npm.io/package/pretty-ms.md) 8.0.0
- [kebab-case](https://npm.io/package/kebab-case.md) 2.0.2
- [log-update](https://npm.io/package/log-update.md) 6.0.0
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) 9.0.0
- [is-interactive](https://npm.io/package/is-interactive.md) 2.0.0
- [@emigrate/types](https://npm.io/package/@emigrate/types.md) 1.0.0
- [@inquirer/input](https://npm.io/package/@inquirer/input.md) 4.1.9
- [elegant-spinner](https://npm.io/package/elegant-spinner.md) 3.0.0
- [import-from-esm](https://npm.io/package/import-from-esm.md) 1.3.3
- [serialize-error](https://npm.io/package/serialize-error.md) 11.0.3
- [@inquirer/select](https://npm.io/package/@inquirer/select.md) 4.2.0
- [@inquirer/confirm](https://npm.io/package/@inquirer/confirm.md) 5.1.9
- [@emigrate/plugin-tools](https://npm.io/package/@emigrate/plugin-tools.md) 1.0.0

## Recent versions

- 1.0.0 (latest) — 2025-11-20
- 0.18.4 — 2025-04-24
- 0.18.3 — 2024-05-30
- 0.18.2 — 2024-03-15
- 0.18.1 — 2024-02-13
- 0.18.0 — 2024-02-09
- 0.17.2 — 2024-02-05
- 0.17.1 — 2024-02-05
- 0.17.0 — 2024-02-05
- 0.16.2 — 2024-01-23
- 0.16.1 — 2024-01-22
- 0.16.0 — 2024-01-22
- 0.15.0 — 2024-01-19
- 0.14.1 — 2024-01-18
- 0.14.0 — 2024-01-18
- … 15 more at https://npm.io/package/@emigrate/cli/versions

## README

# @emigrate/cli

Emigrate is a tool for managing database migrations. It is designed to be simple yet support advanced setups, modular and extensible.

📖 Read the [documentation](https://emigrate.dev) for more information!

## Installation

Install the Emigrate CLI in your project:

```bash
npm install @emigrate/cli
# or
pnpm add @emigrate/cli
# or
yarn add @emigrate/cli
# or
bun add @emigrate/cli
```

## Usage

```text
Usage: emigrate <options>/<command>

Options:

  -h, --help     Show this help message and exit
  -v, --version  Print version number and exit

Commands:

  up      Run all pending migrations (or do a dry run)
  new     Create a new migration file
  list    List all migrations and their status
  remove  Remove entries from the migration history
```

### `emigrate up`

```text
Usage: emigrate up [options]

Run all pending migrations

Options:

  -h, --help              Show this help message and exit

  -d, --directory <path>  The directory where the migration files are located (required)

  -i, --import <module>   Additional modules/packages to import before running the migrations (can be specified multiple times)
                          For example if you want to use Dotenv to load environment variables or when using TypeScript

  -s, --storage <name>    The storage to use for where to store the migration history (required)

  -p, --plugin <name>     The plugin(s) to use (can be specified multiple times)

  -r, --reporter <name>   The reporter to use for reporting the migration progress

  -l, --limit <count>     Limit the number of migrations to run

  -f, --from <name/path>  Start running migrations from the given migration name or relative file path to a migration file,
                          the given name or path needs to exist. The same migration and those after it lexicographically will be run

  -t, --to <name/path>    Skip migrations after the given migration name or relative file path to a migration file,
                          the given name or path needs to exist. The same migration and those before it lexicographically will be run

  --dry                   List the pending migrations that would be run without actually running them

  --color                 Force color output (this option is passed to the reporter)

  --no-color              Disable color output (this option is passed to the reporter)

  --no-execution          Mark the migrations as executed and successful without actually running them,
                          which is useful if you want to mark migrations as successful after running them manually

  --abort-respite <sec>   The number of seconds to wait before abandoning running migrations after the command has been aborted (default: 10)

Examples:

  emigrate up --directory src/migrations -s fs
  emigrate up -d ./migrations --storage @emigrate/mysql
  emigrate up -d src/migrations -s postgres -r json --dry
  emigrate up -d ./migrations -s mysql --import dotenv/config
  emigrate up --limit 1
  emigrate up --to 20231122120529381_some_migration_file.js
  emigrate up --to 20231122120529381_some_migration_file.js --no-execution
```

### Examples

Create a new migration:

```bash
npx emigrate new -d migrations create some fancy table
# or
pnpm emigrate new -d migrations create some fancy table
# or
yarn emigrate new -d migrations create some fancy table
# or
bunx --bun emigrate new -d migrations create some fancy table
```

Will create a new empty JavaScript migration file with the name "YYYYMMDDHHmmssuuu_create_some_fancy_table.js" in the `migrations` directory.

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