An open API service indexing awesome lists of open source software.

https://github.com/shotero/dbmigrator

Database Migration CLI
https://github.com/shotero/dbmigrator

cli nodejs postgres sql

Last synced: 5 months ago
JSON representation

Database Migration CLI

Awesome Lists containing this project

README

          

# DB Migrator

Migrate PostgreSQL database using vanilla SQL files

## Prerequisite:

- PostgreSQL
- Database

## Install

`npm install -g @shotero/dbmigrator`

## Usage

`dbmigrator up -t [target]`

`dbmigrator down -t `

`dbmigrator make `

## Configuration

Sample configuration file:

`.dbmigratorrc.js` OR
`.dbmigratorrc.cjs`

```
const config = {
"creator": "testuser",
"db": {
"user": process.env.DB_USER,
"host": process.env.DB_HOST,
"port": 5432,
"database": "db",
"password": process.env.DB_PASSWORD
},
"paths": {
"up": "./db/migrations/up",
"down": "./db/migrations/down"
},
"migration": {
"schema": "migration",
"table": "migrations"
}
}

module.exports = config;
```

## Example

- `dbmigrator make hello`
- `dbmigrator make world`
- `dbmigrator up`
- `dbmigrator down _world`