From 0d0511716f53c8a6c999f5441cc5d0a365342d45 Mon Sep 17 00:00:00 2001 From: Kylesoda <249518290+kylesoda@users.noreply.github.com> Date: Thu, 16 Apr 2026 12:46:55 -0500 Subject: [PATCH] feat: add row count mismatch error handling in processMigrationJob and update SQL query to exclude additional graph-related columns --- cmd/go_migrate/process.go | 5 +++++ internal/app/etl/table_analyzers/mssql.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/go_migrate/process.go b/cmd/go_migrate/process.go index cfc678b..e525299 100644 --- a/cmd/go_migrate/process.go +++ b/cmd/go_migrate/process.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "sync" "sync/atomic" "time" @@ -233,5 +234,9 @@ func processMigrationJob( result.RowsLoaded = atomic.LoadInt64(&rowsLoaded) result.RowsFailed = atomic.LoadInt64(&rowsFailed) + if result.RowsRead != result.RowsLoaded { + result.Error = fmt.Errorf("Row count mismatch: extracted %d rows but loaded %d rows (failed: %d)", result.RowsRead, result.RowsLoaded, result.RowsFailed) + } + return result } diff --git a/internal/app/etl/table_analyzers/mssql.go b/internal/app/etl/table_analyzers/mssql.go index 0ec0f12..0b230a6 100644 --- a/internal/app/etl/table_analyzers/mssql.go +++ b/internal/app/etl/table_analyzers/mssql.go @@ -36,7 +36,7 @@ JOIN sys.types t ON c.user_type_id = t.user_type_id LEFT JOIN sys.types bt ON t.is_user_defined = 1 AND bt.user_type_id = t.system_type_id JOIN sys.tables st ON c.object_id = st.object_id JOIN sys.schemas s ON st.schema_id = s.schema_id -WHERE s.name = @schema AND st.name = @table AND c.name NOT LIKE 'graph_id%' +WHERE s.name = @schema AND st.name = @table AND c.name NOT LIKE 'graph_id%' AND c.name NOT LIKE 'node_id%' AND c.name NOT LIKE 'edge_id%' ORDER BY c.column_id;` type rawColumnMssql struct {