耙数据库:回滚不起作用?

编程入门 行业动态 更新时间:2024-10-26 09:33:51
本文介绍了耙数据库:回滚不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在编写我的第一个 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.

更多推荐

耙数据库:回滚不起作用?

本文发布于:2023-10-23 19:54:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521852.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   数据库

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!