Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku not updating database schema

Heroku doesn't seem to update my database schema when I deploy. Here are the details:

Here is what is should look like for the User class:

create_table "users", :force => true do |t|
t.string   "username"
t.datetime "created_at"
t.datetime "updated_at"
t.string   "email"
t.string   "encrypted_password"
t.string   "salt"
t.string   "remember_token"
t.boolean  "admin",              :default => false

end

Here is my deploy procedure:

git push heroku master
heroku rake db:migrate
heroku db:push

Everything seems to go smoothly... except that if I check the actually User table in db...

heroku console User

... I get an old version of User...

User(id: integer, username: string, created_at: datetime, updated_at: datetime)

Any idea what I am doing wrong? Thanks a lot for your help!

Simon

like image 794
Simon Avatar asked Oct 24 '10 07:10

Simon


People also ask

Does Heroku wipe database?

Heroku Redis is an in-memory, key-value data store and is not meant for long-term data persistence. After your organization deletes data stored in Heroku Redis, it initiates the data deletion process for any Heroku Redis database snapshots that Heroku Services created.

What version of Postgres does Heroku use?

The most recent major PostgreSQL version supported by Heroku is 14. If you want to upgrade your database's minor version, or if you only want to change your Postgres plan or underlying infrastructure, see Changing the Plan or Infrastructure of a Heroku Postgres Database.


1 Answers

Do you see any output when you heroku rake db:migrate?

Try running heroku restart after you migrate to restart the web servers and DJ workers. That shouldn't influence your console, but I have seen web servers serving old versions of the code immediately after a deploy, which normally isn't a problem but with pending migrations can be.

like image 114
tfe Avatar answered Sep 22 '22 05:09

tfe