Sha256: 0af07ff92c195ac3fdc662170a5bfdf91d9386442d049b30f655770e31fee485

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 Bytes

Contents

class AddOauthEmailToUsers < ActiveRecord::Migration
  def up
    add_column :users, :oauth_email, :string

    User.find_each do |user|
      if user.provider
        user.update_columns oauth_email: user.email, email: ''
      end
    end
  end

  def down
    User.find_each do |user|
      if user.provider
        user.update_columns email: user.oauth_email
      end
    end

    remove_column :users, :oauth_email
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise-ios-rails-1.0.2 spec/dummy/db/migrate/20150305154646_add_oauth_email_to_users.rb
devise-ios-rails-1.0.1 spec/dummy/db/migrate/20150305154646_add_oauth_email_to_users.rb