Guest User

Untitled

a guest
Apr 27th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. class CreateUsers < ActiveRecord::Migration
  2. def self.up
  3. create_table "users", :force => true do |t|
  4. t.string :login, :email, :remember_token, :first_name, :last_name, :limit => 100
  5. t.boolean :admin, :super
  6. t.string :crypted_password, :limit => 40
  7. t.string :password_reset_code, :limit => 40
  8. t.string :salt, :limit => 40
  9. t.string :activation_code, :limit => 40
  10. t.datetime :remember_token_expires_at, :activated_at, :deleted_at, :created_at, :updated_at
  11. t.string :state, :null => :no, :default => 'passive'
  12.  
  13. t.timestamps
  14. end
  15.  
  16. add_index :users, :login, :unique => true
  17.  
  18. # Create a super user
  19. User.create!(:login => 'suadmin',
  20. :email => "youradminemail@somedomain.com",
  21. :first_name => 'Super',
  22. :last_name => 'User',
  23. :password => "your_admin_password",
  24. :password_confirmation => "your_admin_password")
  25. # Create a test user
  26. User.create!(:login => 'testuser',
  27. :email => "yourtestemail@somedomain.com",
  28. :first_name => 'Test',
  29. :last_name => 'User',
  30. :password => "your_test_password",
  31. :password_confirmation => "your_test_password")
  32.  
  33. # Activate accounts after observer calls
  34. @suadmin = User.suadminmake(1)
  35. @testuser = User.force_activate_now(2)
  36.  
  37. end
  38.  
  39. def self.down
  40. drop_table "users"
  41. end
  42. end
Add Comment
Please, Sign In to add comment