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
)
Via Composer
composer require graze/sprout
Via docker
docker run -v [volumes] --rm graze/sprout [command]
See the full documentation for complete usage information.
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
# 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
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
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
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
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
make build test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email security@graze.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.