Skip to content

Instantly share code, notes, and snippets.

@mrichman
Created November 7, 2009 15:32
Show Gist options
  • Select an option

  • Save mrichman/228739 to your computer and use it in GitHub Desktop.

Select an option

Save mrichman/228739 to your computer and use it in GitHub Desktop.
What can I do to make this more useful or less error-prone?
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.timestamps
t.string :login, :null => false
t.string :first_name, :null => false
t.string :last_name, :null => false
t.string :email, :null => false
t.string :website, :null => false
t.string :company_name, :default => ''
t.string :location, :default => ''
t.string :logo_url, :default => ''
t.datetime :born_at
t.string :gender, :default => ''
t.string :address1, :null => false
t.string :address2, :default => ''
t.string :city, :null => false
t.string :state, :null => false
t.string :postal_code, :null => false
t.string :country, :null => false
t.string :home_phone, :default => ''
t.string :work_phone, :default => ''
t.string :mobile_phone, :default => ''
t.string :crypted_password, :null => false
t.string :password_salt, :null => false
t.string :persistence_token, :null => false
t.integer :login_count, :default => 0, :null => false
t.datetime :last_request_at
t.datetime :last_login_at
t.datetime :current_login_at
t.string :last_login_ip
t.string :current_login_ip
end
add_index :users, :login
add_index :users, :persistence_token
add_index :users, :last_request_at
end
def self.down
drop_table :users
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment