feat: add validation feature for row count comparison

Add a validate command that compares row counts between source and target tables after a migration.
This commit is contained in:
2026-05-12 17:00:00 -05:00
parent 6f8a332719
commit 5ee132a1ce
21 changed files with 2072 additions and 200 deletions

View File

@@ -19,8 +19,10 @@ import (
func main() {
configureLog()
checkExpiry()
configPath := flag.String("config", "", "path to migration config file")
validate := flag.Bool("validate", false, "count rows in source and target per job and compare")
flag.Parse()
if flag.NArg() > 1 {
@@ -55,6 +57,7 @@ func main() {
return err
}
log.Info("Successfully connected to sourceDb")
return nil
})
@@ -65,6 +68,7 @@ func main() {
return err
}
log.Info("Successfully connected to targetDb")
return nil
})
@@ -75,6 +79,12 @@ func main() {
defer sourceDb.Close()
defer targetDb.Close()
if *validate {
validationResults := validateJobs(ctx, sourceDb, targetDb, migrationConfig.Jobs, migrationConfig.MaxParallelWorkers)
printValidationReport(validationResults)
return
}
results := processMigrationJobs(ctx, sourceDb, targetDb, migrationConfig.Jobs, migrationConfig.MaxParallelWorkers)
log.Info("=== RESUMEN DE MIGRACIÓN ===")