bilhackmac/databases-manager-module
Composer 安装命令:
composer require bilhackmac/databases-manager-module
包简介
Allows managing multiple connections to databases
README 文档
README
Allows managing multiple connections to databases for other modules and provides commands to parse schema.xml files with multiple definitions.
Installation
Manually…
Copy the module into <thelia_root>/local/modules/ directory and be sure that the name of the module is DatabasesManager.
… or with Composer
Add it in your main thelia composer.json file.
composer require bilhackmac/databases-manager-module:~1.0
Then
Activate it in your thelia administration panel.
Usage
1. schema.xml
Unmodified schema.xml files continue to work as expected but you can now add a new root databases node instead of database.
<databases> <database defaultIdMethod="native" name="thelia" namespace="Module\Namespace\Model"> <table name="theliaTable"> <column type="integer" name="id" required="true" primaryKey="true" autoIncrement="true"/> <column type="integer" name="field" required="true"/> </table> <external-schema filename="local/config/schema.xml" referenceOnly="true" /> </database> <database defaultIdMethod="native" name="anotherDB" namespace="Module\Namespace\Model"> <!-- Note database name for later --> <table name="externalTable"> <column type="integer" name="id" required="true" primaryKey="true" autoIncrement="true"/> <column type="integer" name="field" required="true"/> </table> </database> <!-- Add any database node you need ---> </databases>
2. Commands
Databases manager override two Thelia 2 commands and adds one.
php Thelia module:generate:model <moduleName>
and
php Thelia module:generate:sql <moduleName>
always work as expected but now handles databases and multiples database nodes in schema.xml files. These commands also add an empty database configuration for every unkown database name in configuration file (e.g. : anotherDB in previous schema.xml).
php Thelia module:schema:recovery <moduleName>
can recover schema.xml if unexpected exit happens during any of two previous command (e.g. : Ctrl + C).
3. Configuration
Access to databases configuration by clicking on Configure from backoffice module manager. You can now add/edit/delete databases configurations.
But be careful, configuration labels have to be the same as schema.xml database nodes name, otherwise, models will not be able to find connection to their databases.
You can define database configuration for your current environment (prod by default and dev when accessing with index_dev.php). Environment configuration with the same label as shared configuration overwrite it.
It's can be useful if you don't want that dev environment access same external database as prod environment.
4. Overwite Thelia default configuration
This feature seems to work, but it's not tested.
If you want connect to another Thelia database than the default one, labeled it thelia. By this way, you can have a production database and a development database.
bilhackmac/databases-manager-module 适用场景与选型建议
bilhackmac/databases-manager-module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 672 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bilhackmac/databases-manager-module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bilhackmac/databases-manager-module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 672
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-03-23