Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. class CreateXaaronUsers < ActiveRecord::Migration
  2. def change
  3. create_table :xaaron_users do |t|
  4. t.string :first_name
  5. t.string :last_name
  6. t.string :user_name
  7. t.string :email
  8. t.string :password
  9. t.string :salt
  10.  
  11. t.timestamps
  12. end
  13. end
  14. end
  15.  
  16. class Roles < ActiveRecord::Migration
  17. def change
  18. create_table :xaaron_roles do |t|
  19. t.string :role
  20. t.timestamps
  21. end
  22. end
  23. end
  24.  
  25. class UserRolesJoin < ActiveRecord::Migration
  26. def change
  27. create_table :xaaron_user_roles, id: false do |t|
  28. t.references :xaaron_user, null: false
  29. t.references :xaaron_role, null: false
  30. end
  31.  
  32. add_index :xaaron_user_roles, :user_id
  33. add_index :xaaron_user_roles, [:role_id, :user_id], unique: true
  34. add_index :xarron_roles, :role, unique: true
  35. end
  36. end
  37.  
  38. PG::UndefinedColumn: ERROR: column "user_id" does not exist
  39. : CREATE INDEX "index_xaaron_user_roles_on_user_id" ON "xaaron_user_roles" ("user_id")/Users/Adam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
  40. /Users/Adam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute''
  41.  
  42. class CreateJoinTableUserRole < ActiveRecord::Migration
  43. def change
  44. create_join_table :users, :roles do |t|
  45. # t.index [:user_id, :role_id]
  46. # t.index [:role_id, :user_id]
  47. end
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement