Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. class CreateUsers < ActiveRecord::Migration
  2. def change
  3. create_table :users do |t|
  4. t.string :name
  5. t.string :email
  6.  
  7. t.timestamps
  8. end
  9. end
  10. end
  11.  
  12. rails generate migration add_index_to_users_email
  13.  
  14. class AddIndexToUsersEmail < ActiveRecord::Migration
  15. def change
  16. end
  17. end
  18.  
  19. ActiveRecord::Schema.define(version: 20131024161033) do
  20.  
  21. create_table "users", force: true do |t|
  22. t.string "name"
  23. t.string "email"
  24. t.string "city"
  25. t.string "state"
  26. t.string "zip"
  27. t.string "mobile_phone"
  28. t.string "mobile_phone_type"
  29. t.date "birth_date"
  30. t.string "user_type"
  31. t.string "ss_num"
  32. t.boolean "agree_to_terms"
  33. t.datetime "created_at"
  34. t.datetime "updated_at"
  35. end
  36.  
  37. end
  38.  
  39. rails generate migration add_index_to_users_email
  40.  
  41. rails generate migration AddIndexToUsers email:string:index
  42.  
  43. class AddIndexToUsers < ActiveRecord::Migration
  44. def change
  45. add_index :users, :email
  46. end
  47. end
  48.  
  49. class AddIndexToUsersEmail < ActiveRecord::Migration
  50. def change
  51. add_index :users, :email, unique: true
  52. end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement