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
- Host: GitHub
- URL: https://github.com/shotero/dbmigrator
- Owner: shotero
- License: mit
- Created: 2022-08-08T09:52:02.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-01T09:17:59.000Z (about 3 years ago)
- Last Synced: 2025-03-24T02:44:25.940Z (over 1 year ago)
- Topics: cli, nodejs, postgres, sql
- Language: JavaScript
- Homepage:
- Size: 1.13 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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`