NAME
dbic-mockdata - Generate mock test data for a DBIx::Class schema
VERSION
Version 0.04
SYNOPSIS
dbic-mockdata --schema-dir /path/to/lib \
--namespace MyApp::Schema \
--dsn "dbi:SQLite:dbname=test.db" [options]
DESCRIPTION
Connects the given DBIx::Class schema and hands it to DBIx::Class::MockData to generate and insert mock rows.
OPTIONS
--schema-dir Directory containing the schema classes (required)
--namespace Top-level schema package name, e.g. MyApp::Schema (required)
--dsn DBI DSN string, e.g. "dbi:Pg:dbname=mydb" (required)
--user Database username
--password Database password
--rows Rows to insert per table (default: 5)
--rows-per-table JSON string for per-table row counts, e.g. '{"Author":10,"Book":3}'
--generators JSON string for custom generators, e.g. '{"email":"user{row}@example.com","status":"active"}'
--seed Random seed for reproducible output
--deploy Create tables that do not yet exist
--wipe Drop and recreate all tables before inserting (destructive)
--dry-run Print generated values without inserting
--only Comma-separated list of tables to populate (e.g. Author,Book)
--exclude Comma-separated list of tables to skip
--verbose Print debug output
--help Show this help
ADVANCED OPTIONS
Rows Per Table
--rows-per-table '{"Author":10,"Book":3}'
Allows different row counts for specific tables. Tables not specified use the global --rows value.
Custom Generators
--generators '{"email":"user{row}@example.com","status":"active"}'
Provides custom value generation for specific columns. The syntax supports:
* Static values: "active", "pending"
* Row number interpolation: "user{row}@example.com" becomes user1@example.com
* Perl code evaluation: "sub { return 'prefix_' . int(rand(1000)) }"
For complex generators, use Perl code syntax:
--generators '{"email":"sub { my ($col,$info,$n,$mock)=@_; return \"user$n\@example.com\"; }"}'