standalone-migrations
standalone-migrations copied to clipboard
Gem does not pick up test db config when using DATABASE_URL env var
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.