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

add guards to db commands #86

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jmarsh24
Copy link
Member

@jmarsh24 jmarsh24 commented Nov 9, 2023

Both @Adeynack and I ran into an issue when trying to run rails db:pull without having the heroku remote added that we ran into the following error which isn't very descriptive to the issue that the app isn't linked properly. I have added a guard statement for both pull_data and pull_assets db tasks that provide instructions to install aws-cli and link the repo to heroku if it's missing.

❯ rails db:pull
Dropped database 'copacoupona_development'
Dropped database 'copacoupona_test'
heroku pg:pull DATABASE_URL copacoupona_development
 ›   Error: Missing required flag:
 ›    -a, --app APP  app to run command against
 ›   See more help with --help
bin/rails aborted!
Command failed with status (2): [heroku pg:pull DATABASE_URL copacoupona_deve...]

Tasks: TOP => db:pull => db:pull_data
(See full trace by running task with --trace)

@jmarsh24 jmarsh24 marked this pull request as ready for review November 9, 2023 12:51
else
puts "AWS CLI is not installed. Please install it to continue."
end
exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the two additions are inconsistent. one exists, the other doesnt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a matching heroku-cli check to the pull_data task.

pull_data will not check for the heroku-cli, and give brew instructions to install the required package as well as check to make sure there is a linked remote repo, if not, it will remind the user to link the heroku remote.

pull_assets will do something similiar except check if aws is installed and if not it will recommend a brew install or just tell the user to install it on their system.

Does this address your concerns?

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.

None yet

2 participants