从 Rails 架构更新生成迁移,而不是相反
我讨厌编写迁移,但模式保持同步很重要。 我更愿意做的是更新我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些谷歌搜索揭示了这个插件: 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/