Heroku Postgres Error: PGError: ERROR: relation “organizations” does not exist (ActiveRecord::StatementInvalid)

后端 未结 13 534
有刺的猬
有刺的猬 2020-11-27 14:27

I\'m having a problem deploying my Rails app to Heroku, where this error is thrown when trying to access the app:

PGError: ERROR: relation \"organiz

相关标签:
13条回答
  • 2020-11-27 14:38

    Are you using devise? I had this exact issue when upgrading to 2.0 - You have to manually change the migration file.

    https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style

    0 讨论(0)
  • 2020-11-27 14:39

    According to my experience (Rails 3.1, Sedar stack) after running pg:reset and db:migrate you might have to run heroku restart.

    0 讨论(0)
  • 2020-11-27 14:39

    In my case, I also had to destroy and recreate my app. I had run a rake db:migrate with a migration file not committed and for whatever reason, the pg:reset wasn't working.

    0 讨论(0)
  • 2020-11-27 14:41

    There may be many reasons for this error. For my app, however, the issue was that I hadn't logged out of the app before I ran the migration (?). So going to this path: http://name_of_my_app.herokuapp.com/logout fixed the problem for me.

    0 讨论(0)
  • 2020-11-27 14:46

    Apparently deleting my entire app and then redeploying from scratch fixed it. I have no idea what the problem was.

    0 讨论(0)
  • 2020-11-27 14:49

    I had a similar issue and ran heroku run rake db:reset and heroku run rake db:migrate to fix the issue. I guess that I just hadn't run the proper migrations to fix the problem.

    0 讨论(0)
提交回复
热议问题