heroku rake db:structure:load failure

2019-04-21 09:50发布

问题:

I need to use some PostgreSQL proprietary features such as rules and triggers for table partitioning. As long as I know, these kind of features cannot be dump to schema.rb so I have changed my schema_format configuration parameter to :sql.

Now, when I try to load rake db:structure:load to load the generated structure.sql into the heroku database, it fails saying: sh: psql: not found

How can I do it?

回答1:

You can use pg:psql to run the script from your development machine against the database:

cd your-rails-project
heroku pg:psql -a your-app-name <db/structure.sql

Just make sure that the branch you have checked out locally is the same as the one you have deployed.