Home>

I am trying to create an operating environment for the rails project using the heroku review app, but I get the following error.

ActiveRecord :: StatementInvalid in Users # index
~~~
PG :: UndefinedTable: ERROR: relation "users" does not exist
LINE 1: SELECT "users". * FROM "users"
                              ^
: SELECT "users". * FROM "users"
~~~
I hope I can do something like

heroku run rake db: migrate,
What should I set to automatically do such a thing with heroku review apps when I git push it?

Please give me an answer! ! m (_ _) m

  • Answer # 1

    You can specify what happens when ReviewApps is created in app.json scripts.
    For example, if a pull request is made as follows, rake db: migrate will automatically run when the ReviewApp environment is built.

      

    "scripts" ;: {
          "postdeploy" ;:"bundle exec rake db: migrate"
      }