我可以仅使用 Rails 的迁移来维护数据库架构吗?
我们的应用程序不会在其最终状态的任何部分使用 Rails,但根据我的经验,迁移是定义模式的一种极好的方式,所以我只想使用 Rails 的一个方面。
这是合理的做法吗?如果没有,是否有任何工具可以用来执行相同类型的工作?我们有一个三阶段的部署环境,包括测试、QA 和生产层,因此这很好地映射到了 Rails 使用的层。然而,我们主要是一家Python商店,所以Pythonic的等价物会很漂亮。
Our application isn't going to use rails for any part of its final state, but migrations are a fantastic way to define schema in my experience, so I'd like to use just that one aspect of rails.
Is this a reasonable thing to do? If not, are there any tools out there than can be used to perform the same sort of job? We have a three-stage deployment environment, with test, QA, and production tiers, so this maps pretty well to the tiers that rails uses. However, we're a python shop primarily, so a pythonic equivalent would be nifty.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我没有什么特别的选择可以给你。但是,如果您决定无论如何使用迁移,您必须知道您不需要仅使用整个 Rails 架构来进行迁移。
只要您安装了 active_record gem,您就可以执行以下操作:
在您的 Rakefile
同一路径上的文件中:
以及您的迁移在 db/migrate 文件夹中。
您不需要整个活动资源和所有 Rails 基础。
I do not have any particular alternative to give you. But if you decide to use the migrations anyway, you must know that you do not need to use the whole rails architecture only for migrations.
As long as you have the active_record gem installed, you can do :
in your Rakefile
In a file on the same path :
And your migrations in the db/migrate folder.
You do not need the whole activeresources and all of rails base.
我会用谷歌搜索Python的等价物。迁移很有趣,如果您喜欢这种工作方式并且它有效,那么它当然是合理的。但是,您应该遵循建议并定期检查 schema.rb,而不是依靠迁移来构建生产服务器。
I would google the python equivalents. Migrations are fun, and if you like working that way and it works, then of course it's reasonable. You should follow the advice however and periodically check in schema.rb, rather than counting on migrations to build your production servers.
我知道你们是一家 Python 商店,但 ActiveRecord Migrations 包有一个 PHP 端口,它非常独立。
https://github.com/ruckus/ruckusing-migrations
I know you are a Python shop but there is a PHP port of the ActiveRecord Migrations package which is very standalone.
https://github.com/ruckus/ruckusing-migrations