Guest User

Untitled

a guest
Mar 11th, 2018
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. class CreateRolesUsersJoin < ActiveRecord::Migration
  2. def self.up
  3. create_table :roles_users, :id => false do |t|
  4. t.integer :role_id, :null => false
  5. t.integer :user_id, :null => false
  6. end
  7.  
  8. logger.info 'Calling User.create...'
  9.  
  10. admin_user = User.create(:login => 'Admin',
  11. :email => 'admin@admin.com',
  12. :password => 'admin',
  13. :password_confirmation => 'admin',
  14. :city => 'Anytown',
  15. :state_id => 1,
  16. :postal_code => '90210',
  17. :body_type_id => 1,
  18. :drink_id => 1,
  19. :ethnicity_id => 1,
  20. :eye_color_id => 1,
  21. :hair_color_id => 1,
  22. :have_children_id => 1,
  23. :height_id => 1,
  24. :looking_for_id => 1,
  25. :marital_status_id => 1,
  26. :religion_id => 1,
  27. :smoke_id => 1,
  28. :want_children_id => 1,
  29. :headline => 'This is my headline',
  30. :country => 'United States',
  31. :gender => 'M',
  32. :seeking_a => 'F',
  33. :description => 'This is my description',
  34. :first_date => 'This is my first date',
  35. :first_name => 'System',
  36. :last_name => 'Administrator',
  37. :born_on => '1973-12-07T22:30:00-05:00',
  38. :interests => 'these, are, my, interests',
  39. :occupation => 'unemployed',
  40. :yahoo_im => 'my_yahoo_im',
  41. :aol_im => 'my_aol_im',
  42. :msn_im => 'my_msn_im@hotmail.com',
  43. :gtalk_im => 'my_gtalk_im@gmail.com',
  44. :languages => 'english, spanish, esperanto, klingon',
  45. :status => 'active')
  46.  
  47. logger.info 'Calling admin_user.save!...'
  48.  
  49. admin_user.save!
  50.  
  51. admin_role = Role.find_by_name('Administrator')
  52. admin_user.roles << admin_role
  53. end
  54.  
  55. def self.down
  56. drop_table :roles_users
  57. User.find_by_login('Admin').destroy
  58. end
  59. end
  60.  
  61.  
  62.  
  63. # Logfile created on Mon Jan 07 14:32:43 -0500 2008 SQL (0.000000) select sqlite_version(*)
  64. SQL (0.000000) SQLite3::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
  65. SQL (0.000000) SELECT version FROM schema_info
  66. SQL (0.000000) SELECT version FROM schema_info
  67. SQL (0.000000) SQLite3::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
  68. SQL (0.000000) SELECT version FROM schema_info
  69. Migrating to CreateRolesUsersJoin (18)
  70. SQL (0.000000) SQLite3::SQLException: no such table: roles_users: DROP TABLE roles_users
  71. SQL (0.000000) select sqlite_version(*)
  72. SQL (0.000000) SQLite3::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
  73. SQL (0.000000) SELECT version FROM schema_info
  74. SQL (0.000000) SELECT version FROM schema_info
  75. SQL (0.000000) SELECT version FROM schema_info
  76. SQL (0.000000) SELECT * FROM schema_info
  77. SQL (0.000000)  SELECT name
  78. FROM sqlite_master
  79. WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  80. 
  81. SQL (0.000000) PRAGMA index_list(body_types)
  82. SQL (0.000000) PRAGMA index_list(drinks)
  83. SQL (0.000000) PRAGMA index_list(ethnicities)
  84. SQL (0.000000) PRAGMA index_list(eye_colors)
  85. SQL (0.015000) PRAGMA index_list(hair_colors)
  86. SQL (0.000000) PRAGMA index_list(have_childrens)
  87. SQL (0.000000) PRAGMA index_list(heights)
  88. SQL (0.000000) PRAGMA index_list(looking_fors)
  89. SQL (0.000000) PRAGMA index_list(marital_statuses)
  90. SQL (0.000000) PRAGMA index_list(photos)
  91. SQL (0.000000) PRAGMA index_list(religions)
  92. SQL (0.000000) PRAGMA index_list(roles)
  93. SQL (0.000000) PRAGMA index_list(smokes)
  94. SQL (0.000000) PRAGMA index_list(states)
  95. SQL (0.000000) PRAGMA index_list(users)
  96. SQL (0.000000) PRAGMA index_info('index_users_on_login')
  97. SQL (0.000000) PRAGMA index_list(want_childrens)
Add Comment
Please, Sign In to add comment