为什么 rake db:migrate 不报告版本号?

发布于 2024-07-29 05:47:24 字数 318 浏览 5 评论 0原文

rake 0.8.7、rails/activerecord 2.3.3

rake db 的输出:migrate:

== CreateProducts: 迁移 ============================= ===================== -- 创建表(:产品) -> 0.0017秒 == CreateProducts:已迁移(0.0019s)============================================

应该版本号(在本例中为 20090724013528)是否出现在迁移名称之前?

rake 0.8.7, rails/activerecord 2.3.3

Output from rake db:migrate:

== CreateProducts: migrating =================================================
-- create_table(:products)
-> 0.0017s
== CreateProducts: migrated (0.0019s) ========================================

Shouldn't the version number, in this case 20090724013528, appear before the migration name?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

韵柒 2024-08-05 05:47:24

我记不清 100%,但我认为当他们将迁移切换到 UTC 时间戳时,他们删除了输出中的数字。

但是,您可以使用以下命令检查数据库的当前版本:

rake db:version

I can't remember 100% but I think they removed the number in that output when they switch migrations over to the UTC timestamps.

You can however check the current version of your DB using:

rake db:version
心房的律动 2024-08-05 05:47:24

正如 paulsnotes 所指出的,时间戳代表版本号。 如果您确实想切换回顺序编号,可以在environment.rb 中设置一个标志。

config.active_record.timestamped_migrations = false

As pointed out by paulsnotes, the timestamp represents the version number. If you really want to switch back to sequential numbers, you can set a flag in environment.rb.

config.active_record.timestamped_migrations = false
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文