I have a problem with pushing my migrations to the production database.
The issue:
I\'ve
It doesn't look like you are pushing changes to Heroku. Steps should be as follows;
git add .
git commit -m "Adding features"
git push heroku master
- assuming you are using heroku
as your remote name and you are working in the master
branchheroku run rake db:migrate
to run the migrations ON HEROKUheroku restart
That should be all you need to get you working.
I had the same problem; I git added the migrations, git pushed them to the server, cap deployed them, and the database didn't change. Logged in to the server directly, ran rake db:migrate, and the command line seemed to run the migration, but nothing changed.
In my case, somehow rake db:migrate was using the wrong RAILS_ENV. I logged in to the server, and ran
rake db:migrate RAILS_ENV=production
This caused the database to create the new columns, and then all of the code that I had debugged in the test database started working on the server.
I just had same problem. After adding a column to my DB locally, I did heroku run rake db:migrate -app [my app name]
. Running my code on production, I got ActiveRecord::UnknownAttributeError (unknown attribute '_____' for [table name].)
This solved my problem:
heroku restart --app [my app name]
My two cents based on my experience: I thought that heroku run db:migrate
also migrated db content into production. No! Only structure. So in my case, log in was not working in production because there were no users in it. I had to sign test user up again and then it worked. Hope it helps rookies like me out there