Sha256: 40bbd5f3def74273b3b621946650b29af0bb420ea7e4f8395c506194c487c5ea

Contents?: true

Size: 351 Bytes

Versions: 2

Compression:

Stored size: 351 Bytes

Contents

class AddStateToUser < ActiveRecord::Migration
  def self.up
    add_column :users, :state, :string, :default => 'active'
    
    unless $schema_generator
      users = User.find(:all)
      users.each do |user|
        user.state = 'active'
        user.save!
      end
    end
    
  end

  def self.down
    remove_column :users, :state
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typo-5.2.98 db/migrate/080_add_state_to_user.rb
typo-5.3 db/migrate/080_add_state_to_user.rb