standalone-migrations
standalone-migrations copied to clipboard
move environment config into connection task
move environment configuration into connection task, so it's not executed in situations where no standalone-migrations task is called. Allows other rake tasks to be executed when db/config.yml is missing. fixes #152
would love to get some feedback on this proposed change. Maybe even suggestions how to get it working with older version of activerecord.
Agreed, it's not ideal that the config is required even when the task isn't called. If anyone else using the project also has this need feel free to offer @salzig a hand or offer suggestions to try and come up with a general purpose approach for this.
Hello @thuss @salzig . Can you merged the Pull Request ( @thuss )? I need the feature that fixes this issue.
I need the feature because I use Multiple database support and when I type a command bundle exec rake --tasks in the console, then I get the following error:
rake aborted!
Cannot load database configuration:
Could not load database configuration. No such file - ["db/config.yml"]
/home/cuurjol/ror/my_projects/sql_academy_activerecord/Rakefile:5:in `<top (required)>'
/home/cuurjol/.rbenv/versions/2.6.3/bin/bundle:23:in `load'
/home/cuurjol/.rbenv/versions/2.6.3/bin/bundle:23:in `<main>'
Caused by:
Could not load database configuration. No such file - ["db/config.yml"]
/home/cuurjol/ror/my_projects/sql_academy_activerecord/Rakefile:5:in `<top (required)>'
/home/cuurjol/.rbenv/versions/2.6.3/bin/bundle:23:in `load'
/home/cuurjol/.rbenv/versions/2.6.3/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
With this change the unit tests on Travis are failing with ActiveRecord 4.2.0 and 5.0.0 which is why this PR has never been merged. I think it's fine to say we don't support those older versions anymore but that will require changes in Gemfile, standalone_migrations.gemspec, and .travis.yml before we could merge this PR.
just ran into the same issue!
also why is the file path hardcoded? shouldnt it be configurable?