2

I currently changed my ActiveRecord schema format to :sql and when migrating (rake db:migrate), I get the following error with no real explanation as to what is wrong:

$ bundle exec rake db:migrate
rake aborted!
Error dumping database

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

I'm using Rails 4.2.4 and PostgreSQL 9.4.

1 Answer 1

1

After following the debug trail in the Rails code, I finally discovered the error.

The pg_dump command is being executed in activerecord/lib/active_record/tasks/postgresql_database_tasks.rb#54. After printing the output of the command execution with $?, I realized it was returning a 127 exit code, which means that the command was not found.

It turns out that the pg_dump command was not in my executable PATH. I simply added it by creating a symbolic link and it all worked fine:

ln -s /opt/local/lib/postgresql94/bin/pg_dump /usr/local/bin

NOTE: I also found out that the issue of not printing out the error has already been fixed in Rails 4.2.5

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.