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:
@@ -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 ===")
|
||||
|
||||
Reference in New Issue
Block a user