30 lines
943 B
Ruby
30 lines
943 B
Ruby
class CreateUserExtensions < ActiveRecord::Migration
|
|
class User < ActiveRecord::Base; end
|
|
class UserExtensions < ActiveRecord::Base; end
|
|
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
|
|
end
|
|
|
|
def self.down
|
|
drop_table :user_extensions
|
|
end
|
|
end
|