迁移数据库时为什么一直出错? Heroku的

时间:2013-05-16 23:27:29

标签: sql ruby-on-rails heroku heroku-toolbelt heroku-postgres

我正在使用rails应用程序,我一直收到错误消息,

AddIndexToUsersEmail: migrating ===========================================
-- add_index(:users, :email, {:unique=>true})
rake aborted!
An error has occurred, this and all later migrations canceled:

Index name 'index_users_on_email' on table 'users' already exists/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/schema_statements.rb:576:in `add_index_options'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_reco

以下是迁移:

class AddIndexToUsersEmail < ActiveRecord::Migration
  def change
    add_index :users, :email, unique: true
  end
end

1 个答案:

答案 0 :(得分:1)

这是因为您之前的某个迁移设置了users表的索引,检查您的迁移并将其从中移除以删除此迁移