如何构建“迁移”或 FuelPHP 中模块的类似功能
FulePHP 是一个 HMVC 框架,允许“模块”拥有自己的 MVC 结构。该框架还提供了一个名为“迁移”的方便工具,可以解决数据库和数据迁移问题。以优雅的方式解决代码版本冲突(在开发过程中)。
然而,迁移工具是应用程序方面的。包DB Schemae和的管理不支持夹具。
我想出了这些替代解决方案:
- 构建并测试每个模块及其依赖项作为 FuelPHP 项目,以便可以专门使用“迁移”。需要大量配置,并具有严格的环境(开发/生产)分支策略。
- 更新或安装模块后,扫描“APPPATH/modules/[mod_name]/migrations”中的文件并将其链接到“migrations”。
- 传统方式:维护数据库模式和数据库的 sql 文件。手动固定,如果在运行时找不到表则加载。
将解决方案 1 和 2 结合起来似乎是合理的,但需要大量的工作。是否有一些优雅的方法可以做到这一点,或者将迁移支持移植到模块?
提前致谢。
** 编辑,“模块”应该是我正在寻找的地方,而不是“包”
简而言之,我希望我的模块目录看起来像
- :
- 控制器
- 型号
- 查看
- 配置
- 迁移
- lang
- 视图
FulePHP is a HMVC framework that allows 'modules' to have their own MVC structure. The framework also provides a handy tool called 'migration', that resolves database & code version conflicts (during development) in an elegant way.
However, the migration tool is app-wise. Management of package DB Schemae & Fixtures is not supported.
I came up with these alternative solutions :
- Build and test each modules with it's dependency as a FuelPHP project, so that 'migrations' can be used exclusively. Requires a whole lot of configurations, with a strict and environment (dev/production) branch policy.
- Scan and link files in 'APPPATH/modules/[mod_name]/migrations' to 'migrations' after updating or installing a modules.
- The legacy way: Maintain sql files for DB schema & fixture by hand, loaded if tables were not found at runtime.
Combining solution 1 and 2 seems reasonable, but would take a great amount of work. Is there some elegant way to do so, or to port migration support to modules?
Thanks in advance.
** edited, 'modules' should be where I'm looking for, not 'packages'
In short, I'd like to have my module directory look like:
- classes
- controller
- model
- view
- config
- migrations
- lang
- views
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经支持包中的迁移。
Migrations in packages are already supported.