1. Grab a YAML dump of your production database schema
- Use SQLFairy's SQL::Translator
- For example:
% mysqldump -d mydatabase | perl -MSQL::Translator -e
'my $trans = SQL::Translator->new;
print $trans->translate(
from => "MySQL", to => "YAML",
data => join("", <STDIN>));'
> config.yaml
- Keeping the YAML file up to date is easily automated - script, cron job, whatever
- Call build_test_db() every time it changes