Reputation: 2946
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.
Upvotes: 2
Views: 1693
Reputation: 2946
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
Upvotes: 1