扶手:像迁移运行rake任务 [英] Rails: run rake tasks like migrations

查看:137
本文介绍了扶手:像迁移运行rake任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发团队需要更多的precisely运行rake任务。有迹象表明,需要一个特定的code修改后只运行一次某些任务。如果没有太具体的,它会像后,需要对新用户的新业务规则中的code实现更新某些现有用户的记录。

我们喜欢的迁移如何使用数据库表进行日志记录。是否有rake任务类似工具?我们可以破解Rails的/的ActiveRecord的迁移系统rake任务?

我们倒是preFER不要混用DB相关的迁移与rake任务,使明确保留这些独立的任何解决方案将是巨大的。

感谢。

解决方案
  

需要一个特定的code修改后只运行一次

     

更新某些现有的用户记录

这些都是移民。使用迁移。除非有一些额外的限制你没有提到,使用任何东西,但迁移将是一个黑客。

My dev team needs to more precisely run rake tasks. There are certain tasks that need to be only run once after a specific code change. Without getting too specific, it would be like needing to update certain existing users records after a new business rule for new users is implemented in the code.

We like how migrations use a db table for logging. Is there a similar tool for rake tasks? Can we hack Rails'/ActiveRecord's migrations system for rake tasks?

We'd prefer not to mix db-related migrations with rake tasks, so any solution that explicitly keeps these separate would be great.

Thanks.

解决方案

need to be only run once after a specific code change

update certain existing users records

These are migrations. Use migrations. Unless there's some additional constraints you didn't mention, using anything but migrations would be a hack.

这篇关于扶手:像迁移运行rake任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆