diff --git a/src/migrator/full_migration.py b/src/migrator/full_migration.py index 7563795..426161e 100644 --- a/src/migrator/full_migration.py +++ b/src/migrator/full_migration.py @@ -161,6 +161,23 @@ class FullMigrator: # Get final actual count from PostgreSQL final_count = pg_conn.get_row_count(pg_table) + + # Update migration state with final count and mark as completed + # Get the actual last ID from the table + try: + with pg_conn.connection.cursor() as cursor: + cursor.execute( + f"SELECT MAX(id) FROM {pg_table}" + ) + result = cursor.fetchone() + final_last_id = result[0] if result and result[0] else None + except Exception: + final_last_id = None + + self._update_migration_state( + pg_conn, final_count, final_last_id, migration_start_time + ) + logger.info( f"✓ Migration complete: {final_count} total rows in {pg_table}" )