【发布时间】:2014-03-21 07:56:23
【问题描述】:
我在自己的数据库上进行了一些本地迁移,当我尝试在 heroku 上迁移时,它给了我一个终止:
Multiple migrations have the name CreateUsers
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:978:in `validate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:876:in `initialize'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:in `new'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:in `up'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:742:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
我试过 heroku pg:reset DATABASE 并再次迁移,仍然给我这个错误
在本地运行数据库似乎没问题。有什么建议吗?
【问题讨论】:
-
这个
Multiple migrations have the name CreateUsers看起来很有帮助。您是否有两个具有相同类名的迁移? -
20140219235208_create_users.rb 20140220063644_add_years_to_users.rb 20131225101255_add_password_digest_to_users.rb 20131225095857_add_index_to_users_email.rb 20140103210551_add_remember_token_to_users.rb这些都是迁移跨度>
-
我说的是类名,不是文件名。查看文件内部:其中两个文件开头是否有
class CreateUsers?他们都需要有一个独特的类。 -
不,他们没有。每个人都有一个独特的班级
-
请您在命令行中运行它,在您的 rails 项目文件夹中,然后将结果发布到您的问题的编辑中吗?
tail -n 100 db/migrate/*
标签: ruby-on-rails ruby database heroku migration