从 Rails 架构更新生成迁移,而不是相反

发布于 2024-07-22 05:32:15 字数 117 浏览 2 评论 0原文

我讨厌编写迁移,但模式保持同步很重要。 我更愿意做的是更新我的 schema.rb 并让 Rails 通知,然后运行一些东西,根据旧版本和当前版本之间的差异生成适当的迁移。

我有办法做到这一点吗?

I hate writing migrations, but it's important for the schemas to stay in sync. What I'd much rather do is update my schema.rb and have Rails notice, then run something which generates the appropriate migration based on the difference between the old version and the current version.

Is there a way I can do that?

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

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

发布评论

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

评论(1

遗失的美好 2024-07-29 05:32:15

一些谷歌搜索揭示了这个插件: http://errtheblog.com/posts/65-automatically

它实际上并没有为您创建迁移。 但看起来它基本上满足了您的要求。

编辑:这是插件代码的最新链接: http://github.com/pjhyett /auto_migrations/

Some Googling revealed this plugin: http://errtheblog.com/posts/65-automatically

It does not actually create migrations for you. But it looks like it does basically what you are looking for.

Edit: Here is the up-to-date link to the plugin code: http://github.com/pjhyett/auto_migrations/

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