graze/sprout
Composer 安装命令:
composer require graze/sprout
包简介
Seed data for your project
README 文档
README
Sprout is a tool to help Dump, Truncate and Seed development data into your databases.
- Seed sql data from local files
- Dump data from mysql tables
- Performs actions in parallel
- Handle multiple groups of seed data (for example,
static,core,testing)
Install
Via Composer
composer require graze/sprout
Via docker
docker run -v [volumes] --rm graze/sprout [command]
Usage
See the full documentation for complete usage information.
File Structure
Sprout will use the following file structure by default, you can change the root and each group's path in the configuration file.
- /seed
- group1
- schema1
- table1.sql
- table2.sql
- schema2
- table3.sql
- group1
- schema3
- table4.sql
Quick Start
# Dump all tables you are interested in sprout dump --config=config/sprout.yml --group=static a_schema:table_1,table_2 ... # Store the data in your repository of choice git add /seed/static/* # Seed the data from your local files sprout seed --config=config/sprout.yml --group=static
Seeding
sprout seed [--config=<path>] [--group=<group>] [--no-chop|--chop-all] [<schema>[:<table>,...]] ... sprout seed --config=config/sprout.yml the_schema sprout seed --config=config/sprout.yml --chop-all the_schema sprout seed --config=config/sprout.yml --no-chop the_schema sprout seed --config=config/sprout.yml the_schema:country sprout seed --config=config/sprout.yml --no-chop the_schema:country other_schema:planets sprout seed --config=config/sprout.yml --group=core sprout seed --config=config/sprout.yml --group=core the_schema sprout seed --config=config/sprout.yml --no-chop --group=extra sprout seed --config=config/sprout.yml --chop-all --group=extra
Truncating the data from all the tables in a schema
sprout chop [--config=<path>] [--group=<group>] [--all] [<schema>[:<table>,...]] ... sprout chop --config=config/sprout.yml the_schema sprout chop --config=config/sprout.yml the_schema:country sprout chop --config=config/sprout.yml --all the_schema sprout chop --config=config/sprout.yml --group=core the_schema sprout chop --config=config/sprout.yml --group=extra the_schema:country sprout chop --config=config/sprout.yml --group=extra --all
Dumping the data from all tables in a schema
sprout dump [--config=<path>] [--group=<group>] [<schema>[:<table>,...]] ... sprout dump --config=config/sprout.yml the_schema sprout dump --config=config/sprout.yml the_schema:country sprout dump --config=config/sprout.yml --group=core sprout dump --config=config/sprout.yml --group=core the_schema:country
Configuration
The configuration file follows the following standards.
By default sprout looks for a config/sprout.yml file, you can specify a different file
using --config=path/to/file.yml.
defaults: group: core # default path path: /seed # number of simultaneous processors to run at a time (default: 10) simultaneousProcesses: 10 # ability to specify custom paths for groups groups: core: path: /custom/path/to/group schemas: # name of the schema to reference <name>: # [optional] the actual name of the schema in the database. If not specified, <name> from above will be used schema: 'schema' # Connection details - this is just an example, you may want to specify # different properties, e.g. if connecting to a remote server. You are # advised to refer to the 'pdo' documentation for further details. connection: user: 'morphism' password: 'morphism' # driver for the database connection, currently only: `mysql` is supported driver: 'mysql' # [optional] name of the database dbName: 'schema' # database on a remote host host: 'db' # [optional] port to use, by default: 3306 port: 3306
Testing
make build test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email security@graze.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
graze/sprout 适用场景与选型建议
graze/sprout 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「graze」 「database seeder」 「sprout」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 graze/sprout 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 graze/sprout 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 graze/sprout 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Merge arrays recusively using custom value choosers
Retry tasks that fail due to transient faults
Store your language lines in the database, yaml or other sources
run a pool of processes simultaneously
Philippines region, province, cities/municipalities and barangays Laravel migration and table seeder.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-09