Postgres migration tool built with Node.js using the Postgres.js driver
npm install pg-changePostgres migration tool built with Node.js using the Postgres.js client
npx pgChange or npm i -g pgChange
Put this pgChange.json configuration file in the root directory of your project with your own values here:
```
{
"migrationsPath": "migrations",
"postgresHost": "localhost",
"postgresPort": "5432",
"postgresUser": "postgres",
"postgresPassword": "password",
"postgresDb": "postgres"
}
Don't forget to add pgChange.json to your .gitignore file
``
pgChange create users
Created migration 1724709481967_users.js
migrations/1724709481967_users.js:
`
export default async function (sql) {
return sql
CREATE TABLE USERS (
id SERIAL PRIMARY KEY,
email TEXT NOT NULL,
password TEXT NOT NULL
);
`
}
``
pgChange run-latest
Running migration 1724709481967_users.js
``
pgChange run 1724709481967_users.js
Running migration 1724709481967_users.js
```
npm i
npm link