Skip to content

db-migrate does not respect database.json when DATABASE_URL is specified #406

@troygoode

Description

@troygoode

related to #308

A best-practice for developing Heroku apps is to set a .env file and then execute heroku local (https://devcenter.heroku.com/articles/heroku-local), which will populate process.env using that file. A common .env file will look like so:

DATABASE_URL=postgres://localhost:5432/example

In general, usage of a .env file and leveraging something like https://www.npmjs.com/package/dotenv is a common practice even when not deploying to Heroku. Many other deployment enviornments, including AWS BeanStalk, now use environment variables for specifying the configuration of the deployed application. Because of this it makes sense to use environment variables for your local development configuration as well. Configuring via environment variables is the recommendation of the 12 Factor App methodology.

Unfortunately db-migrate does not play nicely with this common practice. By specifying a DATABASE_URL environment variable, db-migrate will no longer read any options from database.json, including options like "sql-file": true.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions