Ruby on rails 即使在完全运行迁移之后,Rake也会中止

Ruby on rails 即使在完全运行迁移之后,Rake也会中止,ruby-on-rails,migration,rake,Ruby On Rails,Migration,Rake,当我生成一个新的迁移,并通过上下两步进行检查时,我得到“rake中止!”最后当我下山时,虽然它运行了所有的迁移。在迁移过程中没有问题,一切都很顺利。有人能告诉我为什么会这样吗 $ rake db:migrate VERSION= 20140217090240 == CreateSections: reverting ================================================= -- drop_table(:sections) -> 0.005

当我生成一个新的迁移,并通过上下两步进行检查时,我得到“rake中止!”最后当我下山时,虽然它运行了所有的迁移。在迁移过程中没有问题,一切都很顺利。有人能告诉我为什么会这样吗

 $ rake db:migrate VERSION= 20140217090240
==  CreateSections: reverting =================================================
-- drop_table(:sections)    -> 0.0050s
==  CreateSections: reverted (0.0060s) ========================================

==  CreatePages: reverting ====================================================
-- drop_table(:pages)    -> 0.0030s
==  CreatePages: reverted (0.0040s) ===========================================

==  CreateSubjects: reverting =================================================
-- drop_table(:subjects)    -> 0.0030s
==  CreateSubjects: reverted (0.0230s) ========================================

==  AlterUsers: reverting =====================================================
-- remove_index("admin_users", "username")    -> 0.0180s
-- rename_column("admin_users", "hashed_password", "password")    -> 0.0160s
-- change_column("admin_users", "email", :string, {:default=>"", :null=>false})    -> 0.0110s
-- remove_column("admin_users", "username")    -> 0.0110s
-- rename_table("admin_users", "users")    -> 0.0030s
==  AlterUsers: reverted (0.0680s) ============================================

==  CreateUsers: reverting ====================================================
-- drop_table(:users)    -> 0.0040s
==  CreateUsers: reverted (0.0040s) ===========================================

rake aborted! Don't know how to build task '20140217090240'

(See full trace by running task with --trace)

class CreateUsers < ActiveRecord::Migration
  def up
    create_table :users do |t|
      t.string "first_name", :limit => 25
      t.string "last_name", :limit => 50
      t.string "email", :default => "", :null => false
      t.string "password", :limit => 40     
      t.timestamps
    end
  end

  def down
    drop_table :users
  end
end
$rake db:migrate VERSION=20140217090240
==创建节:还原=================================================
--升降台(:截面)->0.0050s
==CreateSections:已还原(0.0060s)========================================
==CreatePages:还原====================================================
--下拉表格(:页)->0.0030s
==CreatePages:已还原(0.0040s)===========================================
==创建主题:还原=================================================
--下拉表格(:受试者)->0.0030s
==CreateSubjects:已还原(0.0230s)========================================
==用户:正在恢复=====================================================
--删除索引(“管理员用户”、“用户名”)->0.0180
--重命名列(“管理员用户”、“哈希密码”、“密码”)->0.0160s
--更改列(“管理员用户”、“电子邮件”、:字符串、{:default=>“”、:null=>false})->0.0110s
--删除列(“管理员用户”、“用户名”)->0.0110s
--重命名表格(“管理员用户”、“用户”)->0.0030s
==AlterUsers:已还原(0.0680s)============================================
==CreateUsers:正在还原====================================================
--下拉表格(:用户)->0.0040s
==CreateUsers:已还原(0.0040s)===========================================
雷克流产了!不知道如何构建任务“20140217090240”
(通过使用--trace运行任务查看完整跟踪)
类CreateUsers25
t、 字符串“last_name”,:limit=>50
t、 字符串“email”,:default=>“”,:null=>false
t、 字符串“password”,:limit=>40
t、 时间戳
终止
终止
降下
下拉列表:用户
终止
终止
使用

启动迁移运行

  rake db:migrate:up VERSION=version number of migration
 rake db:migrate:down VERSION=version number of migration
在迁移过程中

  rake db:migrate:up VERSION=version number of migration
 rake db:migrate:down VERSION=version number of migration

“CreateUsers”迁移文件包含错误。请先观察用户创建文件。它可能具有某种依赖性,就像您在创建迁移中添加了某些用户角色,但在用户表之前未创建角色表。如果您将“CreateUsers”迁移文件粘贴到某个位置,然后将链接粘贴到此处,则很容易发现问题。

请粘贴您的错误。不清楚。请提供一些有用的信息。我已经在上面粘贴了CreateUsers类。我看不出有什么问题。你能发现什么吗?请检查一下。“:”和“用户”之间是否有空格,如create_table:users请参见“20140217090240”迁移号。是否为create user迁移文件号?或者,您可以通过rake db:migrate——traceplease使用rake db:migrate运行所有迁移,或者只使用rake db:migrate:up VERSION=VERSION\u number\u进行迁移