db-migrate / db-migrate/node-db-migrate

Set migration-dir or scope / internals.migrationMode from config with -e option?

Open
#515 6 comments 4 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
JavaScript
Stars
2.3k
Forks
361
PR merge metrics
No merged PRs in 30d

Description

Hi just trying to figure out how to use db-migrate in a simple way.
I have a database.json in a config directory, postgresql so a connection string for a user that has ownership of a database schema I want to work with.

Is there a way to do something like this?

database.json
```json
{
"myConnection":
{
"connectionString": "etc...",
"migrationMode": "myMode",
"migrations-dir": "./migrations/myConnection"
}
}
```

So that when I do

```bash
db-migrate create something
```

It would create in

`./migrations/myConnection/myMode/date-something.js`

Or even just a migration directory setting per connection config would be nice.

`./migrations/myConnection/date-something.js`

I feel writing so much is not ideal would be nice to just write simple command to up or create new migration.
```bash
db-migrate create something --config=./config/database.json -v -e myConnection
```

Easier like this?
```bash
db-migrate create something -e myConnection
db-migrate up -e myConnection
```

Having it in database connection configs would allow to have multiple connections use the same migration scripts but have different databases/schemas.

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/51117218-set-migration-dir-or-scope-internals-migrationmode-from-config-with-e-option?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.