Repository navigation
Validation
The validate command (and the pre-execution check in run) connects to the source database to verify that the configuration is consistent with the actual schema before any data is touched.
dotnet DbMigrator.dll validate --config config.yamlExit code 0 = valid, exit code 1 = one or more errors.
Add --strict to also fail on warnings:
dotnet DbMigrator.dll validate --config config.yaml --strict| Check | Severity |
|---|---|
Required fields are present (host, database) |
Error |
port is in range 1–65535 |
Error |
ssl_mode is one of: Disable, Allow, Prefer, Require, VerifyCA, VerifyFull
|
Error |
| Source and target point to the same database (same host + port + database) | Error |
| Table name contains characters other than letters, digits, and underscores | Error |
| Column name contains characters other than letters, digits, and underscores | Error |
Each sanitization entry has a recognized strategy
|
Error |
faker strategy is missing the faker method field |
Error |
template strategy is missing the value field |
Error |
parallel_jobs is less than 1 |
Error |
${ENV_VAR} references resolve to a non-empty value |
Error |
Why identifier validation matters: Table and column names are injected directly into SQL
UPDATEstatements. Restricting them to^[a-zA-Z_][a-zA-Z0-9_]*$prevents SQL injection through the config file.
| Check | Severity |
|---|---|
| Table does not exist in source | Error |
| Column does not exist in table | Error |
null_value strategy on a NOT NULL column |
Error |
static with value: null on a NOT NULL column |
Error |
| Faker method name is not recognized | Error |
| Faker method returns text but column type is numeric | Warning |
| Sanitizing a primary key column | Warning |
| Target table has zero rows | Warning |
The CLI prints a summary table per table. Errors are shown in red, warnings in yellow.
✓ users — 3 columns OK
✗ payments — column "cvv" not found
⚠ sessions — table has 0 rows
You can skip schema validation (e.g., when source DB is not accessible from CI) with:
dotnet DbMigrator.dll run --config config.yaml --skip-validationConfig-level checks (field presence, env vars, strategy names) are always run and cannot be skipped.