I have a very simple migration which was created using the 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 great 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 app on Heroku. In one, it works fine. In the other, the column simply doesn't show up.
The output from heroku rake db:migrate looks right:
== AddEmailToUsers: migrating ================================================
-- add_column(:users, :email, :string)
-> 0.0031s
== AddEmailToUsers: migrated (0.0032s) =======================================
But the column isn't there:
>> User.column_names
=> ["id", "created_at", "updated_at", "uid", "provider", "name", "role"]
(By the way, all my database changes have been via generator-created migrations; I haven't touched SQL myself nor edited any migration files.)
This is a production environment so dropping the table is not an option.
Any suggestions for things I can try?
heroku restart
fixes the issue for me.
I think this is a bug in the heroku system. I've just emailed them asking for a fix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With