openstreetmap-website/db/migrate/20110322001319_add_terms_seen_to_user.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

16 lines
440 B
Ruby

class AddTermsSeenToUser < ActiveRecord::Migration[4.2]
class User < ActiveRecord::Base
end
def self.up
add_column :users, :terms_seen, :boolean, :null => false, :default => false
# best guess available is just that everyone who has agreed has
# seen the terms, and that noone else has.
User.update_all "terms_seen = (terms_agreed is not null)"
end
def self.down
remove_column :users, :terms_seen
end
end