openstreetmap-website/db/migrate/20121012044047_add_image_use_gravatar_to_users.rb
Andy Allan d130db9fa8 Avoid more models in old migrations
Although these migrations run fine today, they could break in the future
if changes are made to the current model code.
2019-07-17 12:16:20 +02:00

17 lines
496 B
Ruby

class AddImageUseGravatarToUsers < ActiveRecord::Migration[4.2]
class User < ActiveRecord::Base
end
def self.up
add_column :users, :image_use_gravatar, :boolean, :null => false, :default => false
# For people who don't have images on osm.org, enable Gravatar.
User.where(:image_file_name => nil).update_all(:image_use_gravatar => true)
change_column_default :users, :image_use_gravatar, true
end
def self.down
remove_column :users, :image_use_gravatar
end
end