哪些 php 框架支持数据库迁移?
我正在寻找一个好的 php 框架,支持处理数据库迁移。理想情况下,我希望能够运行一个生成迁移脚本的命令,该脚本可以使用更改更新数据库并可以处理回滚这些更改。有什么东西可以做到这一点吗?
I'm looking for a good php framework with support for handling database migrations. Ideally I would like to be able to run a command that generates a migration script, one that updates the database with changes and can handle rolling back those changes. Is there anything out there that does this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Doctrine 项目支持迁移 - http://www.doctrine -project.org/projects/migrations/2.0/docs/reference/introduction/en
嗯,该文档有点缺乏,至少在介绍中是这样。希望它会变得更好。
虽然在 Symfony 中最受欢迎,但它可以轻松集成到其他框架中,甚至可以单独使用。
The Doctrine project supports migrations - http://www.doctrine-project.org/projects/migrations/2.0/docs/reference/introduction/en
Hmm, that documentation is a bit lacking, at least in the introduction. Hopefully it gets better as it goes on.
Whilst most popular in Symfony, this can easily be integrated into other frameworks or even used on its own.
有前途,但尚未有稳定版本:https://github.com/fuel/fuel
Promising, but not yet have a stable version : https://github.com/fuel/fuel
有一个名为 Laravel 的新 PHP 框架,它的迁移方式与 ruby on Rails 相同。看起来好漂亮啊!
您可以在 http://laravel.com/
迁移文档
此外,该框架引入了捆绑包的概念,它可以为您的项目提供出色的模块化视图。
如果您尝试过,请告诉我们您的经验! :)
There is a new php framework called Laravel and it has migrations the same way as ruby on rails. It seems so pretty!
You can find it at http://laravel.com/
Migrations Docs
In addition, the framework introduces the idea of bundles, what can give to your project a great modular view.
If you try it, tell us your experience! :)
symfony - http://www.symfony-project.org/
在 symfony 中,您可以像 Propel 一样使用 ORM 编写数据库模式,它独立于数据库驱动程序。如果您已经有一个数据库,想要迁移到另一个数据库,我认为您可以转储数据库,更改数据库配置,然后将其重新导入到新数据库。 (虽然我自己没有尝试过。)
symfony - http://www.symfony-project.org/
In symfony you can write database schema using ORM like Propel, it is independant from database driver. If you have a database already, you want to migrate to a different db, I think you can dump the db, change the db config, and re-import it to the new db. (though I have not tried it myself.)
那里有很多可以使用任何数据库的 php 框架。例如 Zend、Ci、Cake 等等。您应该做的一件事是更改通常存储在配置文件中的数据库类型。然后手动迁移数据库。没有可以自动生成迁移脚本的框架。您还可以使用ESF进行数据库迁移
There are much php framework over there that can use any database. For example Zend, Ci, Cake and many others. One thing you should do is change database type that's usually stored in configuration file. And then migrate your database manually. No framework that can generate migration script automatically. U can also use ESF for database migration