我如何知道“rake db:migrate”发生了什么变化?会在申请之前申请吗?
命令 rake db:migrate 会将所有相关的新迁移应用到数据库,并在输出中列出已应用的迁移。
我想提前知道将应用哪些迁移,以便记下生产环境中预期的更改列表。
是否有一个选项可以与 rake db:migrate
结合使用,该选项将向我显示将应用哪些更改,而无需实际应用它们?
The command rake db:migrate
will apply all relevant new migrations to a database and will list in the output the migrations that were applied.
I'd like to know in advance what migrations will be applied so as to note down a list of the changes that are expected in a production environment.
Is there an option I can use in conjunction to rake db:migrate
that will show me what changes will be applied without actually applying them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
rake db:migrate:status
(仅限 Rails 3+)符合要求吗?Does
rake db:migrate:status
(rails 3+ only) fit the bill?我想这就是答案: 显示 Rails 中待处理的迁移 。
如果您使用 capistarno 进行部署,则可以添加与此类似的任务: http://gem-session.com/2010/08/warn-of-pending-migrations-when-deploying-with-capistrano 。
I guess here's the answer: Show pending migrations in rails .
If you are deploying with capistarno, you could add a task similar to this: http://gem-session.com/2010/08/warn-of-pending-migrations-when-deploying-with-capistrano .