Rails 3 Migration not working on Heroku

I have a very simple migration that was created using a generator

class AddEmailToUsers < ActiveRecord::Migration def self.up add_column :users, :email, :string end def self.down remove_column :users, :email end end 

It works fine locally

 rake db:migrate rails console >> User.column_names => ["id", "created_at", "updated_at", "uid", "provider", "name", "role", "email"] 

I have two versions of the application on Heroku. In one, it works great. The other column just does not appear.

The output from geku rake db: migrate looks right:

 == AddEmailToUsers: migrating ================================================ -- add_column(:users, :email, :string) -> 0.0031s == AddEmailToUsers: migrated (0.0032s) ======================================= 

But there is no column there:

 >> User.column_names => ["id", "created_at", "updated_at", "uid", "provider", "name", "role"] 

(By the way, all my changes in the database occurred through those created by the migration generator, I myself did not touch SQL and did not edit any migration files.)

This is a production environment, so dropping a table is not an option.

Any suggestions for things I can try?

+4
source share
2 answers

hero reboot

fixes the problem for me.

I think this is a bug in the heroku system. I just emailed them asking for a fix.

+12
source

Did you run "heroku rake db: migrate"? This migration is not performed locally, but on Heroku.

0
source

Source: https://habr.com/ru/post/1342038/


All Articles