standalone-migrations icon indicating copy to clipboard operation
standalone-migrations copied to clipboard

Gem does not pick up test db config when using DATABASE_URL env var

Open landovsky opened this issue 7 years ago • 0 comments

I use .env file to pass postgres url into my apps.

Using this approach, I cannot migrate test environment db using standalone-migrations.

When DATABASE_URL is set in environment, gem ignores existing configuration when other env is specified: rake db:drop db:create db:migrate RAILS_ENV=testing (where testing refers to valid config.yml) takes whatever is stored in DATABASE_URL and creates the database. It does it in the specified (testing) mode so that dropping the database with rake db:drop produces ActiveRecord::EnvironmentMismatchError.

landovsky avatar Sep 03 '18 10:09 landovsky