postgresql - Add_Index() Error using Rails ,PostGres and Windows xp -
i'm trying add index models, keep getting error.
pg:error error:column "user_id" not exist :create index "index_users_on_user_id" on "users" ("user_id")
class createusers < activerecord::migration def self.up create_table :users |t| t.references :role t.references :carrier t.string "first_name" t.string "last_name" t.string "user_name" t.string "hashed_password" t.string "user_salt" t.string "telephone" t.timestamps end add_index("users", "user_id") add_index("users", "role_id") add_index("users", "user_name") end def self.down drop_table :users end end
you don't have anywhere column user_id in migration. automagical column rails creates called 'id'.
Comments
Post a Comment