Rails 5 how to clear or delete production postgres database

From Heroku's documentation on Running Rake commands:

The db:reset task is not supported. Heroku apps do not have permission to drop and create databases. Use the heroku pg:reset command instead.

So instead of trying to have rails or rake db:reset, try this:

heroku pg:reset


It also happens when you dump production database into local. If you want to delete it on local machine, you will need to set bin/rails db:environment:set RAILS_ENV=development, and after rake db:drop


Try this it worked for me:

RAILS_ENV=production rake db:drop DISABLE_DATABASE_ENVIRONMENT_CHECK=1 

in a single line.