Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move environment config into connection task #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

salzig
Copy link

@salzig salzig commented Feb 19, 2019

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

@salzig
Copy link
Author

salzig commented Feb 19, 2019

would love to get some feedback on this proposed change. Maybe even suggestions how to get it working with older version of activerecord.

@thuss
Copy link
Owner

thuss commented Feb 19, 2019

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.

@gwynolanga
Copy link

gwynolanga commented May 3, 2021

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)

gwynolanga added a commit to gwynolanga/standalone-migrations that referenced this pull request May 3, 2021
@thuss
Copy link
Owner

thuss commented May 3, 2021

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.

@jtoy
Copy link

jtoy commented Aug 27, 2022

just ran into the same issue!

@jtoy
Copy link

jtoy commented Aug 27, 2022

also why is the file path hardcoded? shouldnt it be configurable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

db/config.yml is required in the moment the tasks are loaded.
4 participants