Heroku run rake db:migrate results in no change in the database, app restarted several times
It doesn't look like you are pushing changes to Heroku. Steps should be as follows;
- Make changes to local code
- Run any migrations LOCALLY
- Add all changed files to Git
git add .
- Commit all added files to git
git commit -m "Adding features"
- Push the changes to Heroku
git push heroku master
- assuming you are usingheroku
as your remote name and you are working in themaster
branch - If you have migrations run
heroku run rake db:migrate
to run the migrations ON HEROKU - Following migrations do
heroku 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]