耙数据库:回滚不起作用? [英] rake db:rollback not working?

查看:40
本文介绍了耙数据库:回滚不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写我的第一个 Rails 应用程序.我已经运行了一些 rails generate model ...rake db:migrate 命令,但我现在想更改我的数据模型,因此需要撤消一些迁移.

I'm writing my first Rails app. I've run a few rails generate model ... and rake db:migrate commands, but I now want to change my data model and so need to undo a few migrations.

文档 说我可以使用 rake db 撤消迁移:rollback,但这不起作用.当我在控制台中运行它时,计算机会思考几秒钟,但不会对 db/migrate/db/migrate/schema.rb 进行任何更改.没有输出打印到控制台.

The docs say I can undo a migration with rake db:rollback, but this isn't working. When I run this in the console the computer thinks for a few seconds but doesn't make any changes to db/migrate/ or db/migrate/schema.rb. No output is printed to the console.

这种行为是否正确?db:rollback 不应该改变我的架构吗?如果是这样,有人能想到为什么它可能不起作用吗?

Is this behavior correct? Shouldn't db:rollback be changing my schema? If so, can anyone think why it might not be working?

我在使用 Rails v. 3.2.6.

I'm on Rails v. 3.2.6.

编辑

目前 rake db:migrate:status 给出

database: db/development.sqlite3

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20120617191211  Create irs
   up     20120701154357  Create paths
   up     20120701154421  Create nodes
   up     20120702151447  ********** NO FILE **********
  down    20120702155140  Create venues
  down    20120703233833  Remove path from venues

推荐答案

解决方案(见我的评论):运行

Solution (see my comment): run

rake db:migrate:status

并纠正您在那里发现的问题.在这种情况下(根据 @MarkThomas 的后续跟进),您可能需要检查您需要的所有文件是否就位.

and correct problems you find there. In this case (per @MarkThomas' followup), you might want to check all files you need are in place.

这篇关于耙数据库:回滚不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆