Search code examples
ruby-on-railsherokuspree

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "spree_orders" does not exist


Once spree(3.1) work on local. Next is to push to heroku. I am sure have postgresql. But seem I have to manually do setup table using one of similar rails command. In the document I supposed to run

    rails g spree:install --user_class=Spree::User
    rails g spree:auth:install
    rails g spree_gateway:install

My first question is how to run those command for heroku

My solution is using these commands

   heroku run rake spree:install --user_class=Spree::User
   heroku run rake railties:install:migrations
   heroku run rake db:migrate
   heroku run rake db:seed
   heroku run rake spree_sample:load

Solution

  • You don't need to run these commands again on heroku.

    Just add the files generated by spree to git. Also make sure to add spree migrations to git and then you can just deploy it on heroku.

    Followed by

    heroku run rake db:migrate