From 8d9e63081a090a09441b2a195f59d32c101965d5 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 23 Dec 2025 20:32:33 +0100 Subject: [PATCH] chore: Add detailed logging for migration state update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added logging to trace the final migration state update process: - Log final count from PostgreSQL - Log final last ID from table - Log before and after _update_migration_state() call This helps debug why migration_state might not be getting updated when migration completes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 --- src/migrator/full_migration.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/migrator/full_migration.py b/src/migrator/full_migration.py index f59d175..be9d731 100644 --- a/src/migrator/full_migration.py +++ b/src/migrator/full_migration.py @@ -161,6 +161,7 @@ class FullMigrator: # Get final actual count from PostgreSQL final_count = pg_conn.get_row_count(pg_table) + logger.info(f"Final count from PostgreSQL: {final_count}") # Update migration state with final count and mark as completed # Get the actual last ID from the table @@ -171,12 +172,16 @@ class FullMigrator: ) result = cursor.fetchone() final_last_id = result[0] if result and result[0] else None - except Exception: + logger.info(f"Final last ID from table: {final_last_id}") + except Exception as e: + logger.warning(f"Failed to get final last ID: {e}") final_last_id = None + logger.info(f"About to update migration_state with count={final_count}, last_id={final_last_id}") self._update_migration_state( pg_conn, final_count, final_last_id, migration_start_time ) + logger.info(f"Migration state update complete") logger.info( f"✓ Migration complete: {final_count} total rows in {pg_table}"