082_add_users_options.rb
上传用户:netsea168
上传日期:2022-07-22
资源大小:4652k
文件大小:1k
- class AddUsersOptions < ActiveRecord::Migration
- def self.up
- add_column :users, :firstname, :string
- add_column :users, :lastname, :string
- add_column :users, :nickname, :string
- add_column :users, :url, :string
- add_column :users, :msn, :string
- add_column :users, :aim, :string
- add_column :users, :yahoo, :string
- add_column :users, :twitter, :string
- add_column :users, :description, :text
- remove_column :users, :notify_via_jabber
-
- unless $schema_generator
- users = User.find(:all)
- users.each do |user|
- user.nickname = user.name
- user.save!
- end
- end
- end
- def self.down
- remove_column :users, :firstname
- remove_column :users, :lastname
- remove_column :users, :nickname
- remove_column :users, :url
- remove_column :users, :msn
- remove_column :users, :aim
- remove_column :users, :jabber
- remove_column :users, :yahoo
- remove_column :users, :description
- add_column :users, :notify_via_jabber, :tinyint
- end
- end