# @ventinc/migrator

> A simple library to make migrations with postgres

Latest version **1.0.6** (published 2020-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ventinc/migrator
pnpm add @ventinc/migrator
yarn add @ventinc/migrator
bun add @ventinc/migrator
```

Provides the command `migrator`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-05-02 |
| First published | 2020-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 48.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vincent Dusautoir |
| Maintainers | ventinc |
| Keywords | postgresql, node-postgres, migrations |

## Links

- npm: https://www.npmjs.com/package/@ventinc/migrator
- Repository: https://github.com/Ventinc/migrator
- Homepage: https://github.com/Ventinc/migrator#readme
- Issues: https://github.com/Ventinc/migrator/issues
- npm.io page: https://npm.io/package/@ventinc/migrator

## Dependencies (6)

- [pg](https://npm.io/package/pg.md) ^8.0.3
- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.0
- [commander](https://npm.io/package/commander.md) ^5.1.0
- [clear-module](https://npm.io/package/clear-module.md) ^4.1.1
- [app-root-path](https://npm.io/package/app-root-path.md) ^3.0.0

## Recent versions

- 1.0.6 (latest) — 2020-05-02
- 1.0.5 — 2020-05-02
- 1.0.4 — 2020-05-02
- 1.0.3 — 2020-05-02
- 1.0.2 — 2020-05-02
- 1.0.1 — 2020-05-02
- 1.0.0 — 2020-05-02

## README

# @ventinc/migrator

A simple postgresql migrator that work with raw query

## Intallation

NPM:
`npm i -S @ventinc/migrator`

YARN:
`yarn add -D @ventinc/migrator`

## Configuration

Configuration is mandatory to make CLI and migrator work.
This library use node postgres so connection just need to be a pool configuration: you can see it [here](https://node-postgres.com/api/pool)

By default the name of configuration file is: `migrations.config.js`.
Create this file next to your project package.json

```javascript
module.exports = {
  connection: {
    user: "root",
    host: "localhost",
    database: "databasename",
    password: "password",
    port: 5432,
  },
  types: [
    {
      name: "migrations",
      folder: __dirname + "/migrations",
    },
  ],
};
```

You can create multiple types to make differents migrations like seeds to populate your database.

## How work CLI

Add this in package.json

```json
{
  ...
  "scripts": {
    "migrator": "migrator"
  }
  ...
}
```

and run `yarn migrator` or `npm run migrator` in your terminal

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