Skip to content

Export validation and sanitization report to file (JSON/CSV) #16

Description

@cl8dep

Summary

The validation summary and sanitization results are only printed to the console. There is no way to persist the output for auditing, CI artifact storage, or integration with external tools.

Current Limitation

CommandHelpers.cs renders results as a Spectre.Console table to stdout only. No file output is supported.

Proposed Approach

Add a --report-file option to all commands:

dotnet DbMigrator run --config config.yaml --report-file report.json
dotnet DbMigrator validate --config config.yaml --report-file report.json --report-format json

Supported formats:

  • json — structured report with per-table results, counts, warnings, errors
  • csv — flat table per rule with status

Example JSON output:

{
  "timestamp": "2025-04-06T10:00:00Z",
  "command": "run",
  "status": "success",
  "tables": [
    { "table": "users", "rows_updated": 1500, "columns": 3, "warnings": [] },
    { "table": "payments", "rows_updated": 800, "columns": 1, "warnings": [] }
  ]
}

Acceptance Criteria

  • --report-file <path> saves the report to the specified file
  • --report-format json|csv controls the output format (default: json)
  • Report includes timestamp, command, overall status, and per-table breakdown
  • Console output is unaffected by the flag
  • Works for validate, sanitize, and run commands

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions