@ventinc/migrator

1.0.6 • Public • Published

@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

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

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

{
  ...
  "scripts": {
    "migrator": "migrator"
  }
  ...
}

and run yarn migrator or npm run migrator in your terminal

Package Sidebar

Install

npm i @ventinc/migrator

Weekly Downloads

2

Version

1.0.6

License

MIT

Unpacked Size

50.1 kB

Total Files

35

Last publish

Collaborators

  • ventinc