为什么我使用 db:migrate VERSION=XXX 时出现重复版本错误?
我正在使用一个从 Ruby 1.8.6 升级到 Ruby 1.8.7 的应用程序。我创建了许多名为 999_whatever_function.rb
的迁移脚本,并按顺序排列。之前运行的整个集合包含从 001
到 430
的项目,我添加了最多 450
的项目。当我尝试使用
rake db:migrate VERSION=450
It aborts 并出现此错误
C:\Ruby\projects\db_upgrade>rake db:migrate VERSION=450 --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
**Multiple migrations have the version number 3500**
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/migration.rb:507:in `migrations'
时,我的脚本上没有重复编号,但我想知道版本 1.8.7 是否需要不同类型的版本表示法 (YYYYMMDDTime)?
I'm working with an application that was upgraded from Ruby 1.8.6 to Ruby 1.8.7. I created a number of migration scripts named as 999_whatever_function.rb
, ordered sequentially. The whole set from previous runs have items from 001
until 430
, and I added items up to 450
. When I try to use
rake db:migrate VERSION=450
It aborts with this error
C:\Ruby\projects\db_upgrade>rake db:migrate VERSION=450 --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
**Multiple migrations have the version number 3500**
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/migration.rb:507:in `migrations'
I have no duplicate numbering on the scripts but I'm wondering if the version 1.8.7 requires a different type of VERSION notation (YYYYMMDDTime)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到你说没有重复的迁移,但这就是触发此错误的原因。仔细检查 db/migrate 中迁移的前缀。有两个3500开头的吗?
另外,您还混淆了 Ruby 和 Rails。 Ruby 的版本是 1.8.7,而不是 Rails。看起来您正在运行 Rails 2.3.4。
I see that you say there are no duplicate migrations, but that's what would trigger this error. Double-check the prefixes of the migrations in db/migrate. Are there two that begin with 3500?
Also, you are conflating Ruby and Rails. Ruby is at version 1.8.7, not Rails. It looks like you are running Rails 2.3.4.