【发布时间】:2010-11-15 22:33:45
【问题描述】:
我正在尝试为我的模型添加索引,但不断收到此错误。
PG:错误错误:列“user_id”确实 不存在:创建索引 “index_users_on_user_id”开启“用户” ("user_id")
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |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
【问题讨论】:
标签: ruby-on-rails postgresql ruby-on-rails-3 windows-xp