# This migration comes from refinery_memberships (originally 20120110165302)
class AddActivationFieldsToUsers < ActiveRecord::Migration
  def self.up
    add_column Refinery::User.table_name, :enabled,  :boolean, :default => false
    add_column Refinery::User.table_name, :seen,     :boolean, :default => false
    add_column Refinery::User.table_name, :rejected, :string,  :default => 'UNDECIDED' # uff true, false, FileNotFound......
    Refinery::Memberships::Member.all.each do | m |
      m.seen = true
      m.enabled = m.has_role?(:member)
      m.rejected = 'NO'
      m.save
    end
  end

  def self.down
    remove_column Refinery::User.table_name, :enabled
    remove_column Refinery::User.table_name, :seen
    remove_column Refinery::User.table_name, :rejected
  end

end

{'avg_line_length': 35.77272727272727, 'max_line_length': 124, 'alphanum_fraction': 0.7064803049555273, 'licenses': ['Apache-2.0'], 'repository_name': 'easthertssigns/SignappNew', 'path': 'db/migrate/20130117162737_add_activation_fields_to_users.refinery_memberships.rb', 'size': 787, 'lang': 'Ruby'}