Sha256: 5c20c7c21f59b6530a39d85a8d5e6c900ca5d4f525e764fddaf64b396dec0b6f
Contents?: true
Size: 920 Bytes
Versions: 7
Compression:
Stored size: 920 Bytes
Contents
class AddOpenidFieldToUsers < ActiveRecord::Migration def up unless defined?(User) add_column :users, :openid_identifier, :string add_index :users, :openid_identifier change_column :users, :login, :string, :default => nil, :null => true change_column :users, :crypted_password, :string, :default => nil, :null => true change_column :users, :salt, :string, :default => nil, :null => true end end def down remove_column :users, :openid_identifier # Due to namespacing change, temporarily set the table back to users Spree::LegacyUser.table_name = 'users' [:login, :crypted_password, :salt].each do |field| Spree::User.where(field => nil).each { |user| user.update_column(field, '') if user.send(field).nil? } change_column :users, field, :string, :default => '', :null => false end Spree::LegacyUser.table_name = 'spree_users' end end
Version data entries
7 entries across 7 versions & 1 rubygems