Guest User

Untitled

a guest
Jul 16th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. class CreateUsers < ActiveRecord::Migration
  2. def self.up
  3. create_table :users do |t|
  4. t.string :login, :null => false
  5. t.string :email, :null => false
  6. t.string :crypted_password, :null => false
  7. t.string :password_salt, :null => false
  8. t.string :persistence_token, :null => false # required
  9. t.string :perishable_token, :null => false
  10. t.integer :login_count, :null => false, :default => 0
  11. t.integer :failed_login_count, :null => false, :default => 0
  12. t.datetime :last_request_at
  13. t.datetime :current_login_at
  14. t.datetime :last_login_at
  15. t.string :current_login_ip
  16. t.string :last_login_ip
  17. t.timestamps
  18. end
  19. #
  20. # Add indexes
  21. #
  22. add_index :users, :perishable_token
  23. add_index :users, :email
  24. #
  25. # Create your initial user.
  26. # Will make this an administrator user later.
  27. #
  28. usr = User.create \
  29. :login => 'admin',
  30. :email => 'admin@yoursite.com',
  31. :password => 'betterpassword',
  32. :password_confirmation => 'betterpassword'
  33. end
  34. #
  35. #
  36. def self.down
  37. drop_table :users
  38. end
  39. end
  40.  
  41. class CreateInvitations < ActiveRecord::Migration
  42. def self.up
  43. create_table :invitations do |t|
  44. t.integer :sender_id
  45. t.string :recipient_email
  46. t.string :token
  47. t.datetime :sent_at
  48. t.timestamps
  49. end
  50. end
  51.  
  52. def self.down
  53. drop_table :invitations
  54. end
  55. end
Add Comment
Please, Sign In to add comment