bigdir/db/migrate/20130814084938_create_user_...

30 lines
943 B
Ruby
Raw Normal View History

2013-08-14 21:37:55 +08:00
class CreateUserExtensions < ActiveRecord::Migration
class User < ActiveRecord::Base; end
class UserExtensions < ActiveRecord::Base; end
2013-08-14 21:37:55 +08:00
def self.up
create_table :user_extensions do |t|
t.column :user_id,:integer,:null => false
t.column :birthday,:date
t.column :brief_introduction,:string
t.column :gender,:integer
t.column :location,:string
t.column :occupation,:string
t.column :work_experience,:integer
t.column :zip_code,:integer
t.timestamps
end
user = User.find_by_admin true
user_extensions = UserExtensions.create :user_id => user.id,
:birthday => nil,
:brief_introduction => "",
:gender => 1,
:location => "",
:occupation => nil,
:work_experience => nil
2013-08-14 21:37:55 +08:00
end
def self.down
drop_table :user_extensions
end
end