1.0.6 • Published 3 years ago
postgres-migration v1.0.6
cli-migration
Creating environment variables file
Create a .env file in the root directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. For example:
DB_HOST=localhost
DATABASE_URL=postgresql://localhost:${PORT}/${DATABASE_NAME}
Install package as dev dependency
npm install --save-dev postgres-migration
Usage
structure
.
+-- node_modules
+-- src
| +-- *.js
+-- sql
| +-- 001-create-user-table.sql
| +-- 002-alter-user-table.sql
+-- index.html
+-- package.json
In terminal
postgres-migration
You can do a few things like:
- checking the current migration index
postgres-migration index
- set the current migration index using
postgres-migration seed 7
- run some sql using using
postgres-migration execute "select * from your_table"
or add this in your package.json
file.
{
"script": {
"migrate": "postgres-migration"
}
}
run following command to excute
npm run migrate
Author
👤 Thabang Gideon Magaola
- Website: https://gideon877.github.io/portfolio/
- Twitter: @gideon877
- Github: @gideon877
- LinkedIn: @gideon877
Show your support
Give a ⭐️ if this project helped you!
Contributors
👤 Andre Vermeulen
- Github: @avermeulen