spacetab-io/rdb
Composer 安装命令:
composer require spacetab-io/rdb
包简介
Dead-simple async PHP migrations controlled from code.
README 文档
README
Dead-simple PHP migrations controlled from code.
Features
- Asynchronous migrations build with Amp.
- Developed to use from code and cli.
- Developed to use any database with these tool. Currently supported official Amp Postgres & MySQL clients.
- You can extend console commands to use tool with your custom config definitions instead of always use
--connectflag. - You can use migrations/seeds files from anywhere and with any paths.
Installation
Install tool:
composer require spacetab-io/rdb
and install database client, like this:
composer require amphp/postgres
Usage
use Spacetab\Rdb\Notifier\StdoutNotifier; use Spacetab\Rdb\Rdb; use Spacetab\Rdb\Driver; use Amp\Postgres; use Amp\Postgres\ConnectionConfig; Amp\Loop::run(function () { $config = ConnectionConfig::fromString('host=localhost user=root dbname=test'); /** @var Postgres\Pool $pool */ $pool = Postgres\pool($config); $driver = new Driver\SQL\Postgres($pool); $rdb = new Rdb($driver, new StdoutNotifier()); // Optional. By default notifications is muted. $migrator = $rdb->getMigrator(); yield $migrator->install(); yield $migrator->migrate(); yield $rdb->getSeeder()->run(); });
Usage from cli
vendor/bin/rdb list
Rdb – dead-simple async PHP migrations controlled from code. (v1.0).
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
make
make:migration Create a new migration files
make:seed Create a new seeder file
migrate
migrate:down [migrate:rollback] Rollback the last database migration
migrate:install Create the migration repository
migrate:refresh Reset and re-run all migrations
migrate:reset Rollback all database migrations
migrate:status Show the status of each migration
migrate:up Run the database migrations
seed
seed:run Seed the database with records
Depends
- >= PHP 7.4
- Composer for install package
Tests
- Unit
vendor/bin/phpunit --testsuite Unit - Integration
vendor/bin/phpunit --testsuite Integration. Accept ENV's:PHPUNIT_RDB_PG_HOST,PHPUNIT_RDB_PG_PORT,PHPUNIT_RDB_PG_DBNAME,PHPUNIT_RDB_PG_USER,PHPUNIT_RDB_PG_PWD
License
The MIT License
Copyright © 2020 spacetab.io, Inc. https://spacetab.io
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
spacetab-io/rdb 适用场景与选型建议
spacetab-io/rdb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 75 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 spacetab-io/rdb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 spacetab-io/rdb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 75
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 12
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-13