🌱 Sprout¶
Sprout is a tool to help you Populate your databases with seed data.
It's core method is by using .sql files that can be committed and diffed by your code repository.
It can:
- Seed sql data from local files
- Dump data from mysql tables
- Chop (truncate) data in mysql tables
- Performs actions in parallel
- Handle multiple groups of seed data (for example,
static
,core
,testing
)
Quick Start¶
Getting Sprout¶
You can get sprout in the following ways:
- composer to grab the application using PHP's composer
- docker to run sprout without installing it locally
Configuration¶
You will need a configuration file to tell sprout how to talk to your databases.
Populate your seed data¶
You can group your seed data depending on its purpose. For example: static
, operational
and development
.
Ensure your database is populated with your seed data and run the following command:
sprout dump --config=/path/to/config.yml --group=group1 schema:table1,table2,... schema2:table3,... ...
This will create a set of .sql
files locally containing the data in your database.
Seed your data¶
You can now seed your data using the local files.
sprout seed --config=/path/to/config.yml --group=group1
If you do not need to truncate your tables first, use the --no-chop
option.
sprout seed --config=/path/to/config.yml --no-chop --group=group1