db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

Update db.js command to improve calling dbname #772

Closed TarekElBarody closed 2 years ago

TarekElBarody commented 2 years ago

1- get the dbname from .env using db:drop env.DB_NAME

we can use it inside the script in package.json

"scripts": {
"db-test-create": "db-migrate -e create db:create env.DB_TEST",
"db-test-drop": "db-migrate -e create db:drop env.DB_TEST"
},

2- get the dbname from config json from schema setting without providing the dbname

you should add in database.json schema settings

"create": {
"driver": "",
"host": "";
"user": "",
"password": "",
"schema": "db_name"
}

we can not provide the dbname inside the script in package.json

"scripts": {
"db-test-create": "db-migrate -e create",
"db-test-drop": "db-migrate -e create"
},