schema.rb 转移到新机器后未更新

发布于 2024-08-14 16:11:37 字数 210 浏览 1 评论 0原文

我将一个项目转移到一台新机器上。一切正常。我可以运行迁移,它们会更新 mysql 数据库。但是,schema.rb 文件不确认更改。我检查了 schema.rb 的读/写权限是否正常。有谁知道什么可能导致这个问题。我正在使用 Rails 版本 2.3.5。 rake:redo rake:rollback 不起作用,因为模式不知道数据库中的更改。再次运行 rake db:migrate 不会执行任何操作。

I transfered a project to a new machine. Everything works. I can run migrations and they update the mysql database. However, the schema.rb file doesn't acknowledge the changes. I checked the read/write permissions for schema.rb are OK. Does anyone have any idea about what could cause this problem. I'm using Rails version 2.3.5. rake:redo rake:rollback don't work because the schema is not aware of the changes in database. running rake db:migrate again does nothing.

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

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

发布评论

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

评论(2

‖放下 2024-08-21 16:11:37

答案是我的development.rb 文件中有以下行

config.active_record.schema_format = :sql

注释后,一切正常。

The answer was that I had the following line in my development.rb file

config.active_record.schema_format = :sql

After commenting it, everything worked.

无力看清 2024-08-21 16:11:37

我从未遇到过这个问题,但这可能会解决它:

  1. 备份当前的 schema.rb cp db/schema.rb db/schema.rb.backup
  2. 删除 < em>schema.rb rm db/schema.rb
  3. 运行 rake db:migrate

这将从中重新生成您的 schema.rb 文件当前数据库状态。

I have never encountered this problem but this may solve it:

  1. Take a backup of your current schema.rb cp db/schema.rb db/schema.rb.backup
  2. Delete schema.rb rm db/schema.rb
  3. Run rake db:migrate

This will regenarate your schema.rb file from the current database state.

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