diff --git a/src/migrator/full_migration.py b/src/migrator/full_migration.py index be9d731..cf965a3 100644 --- a/src/migrator/full_migration.py +++ b/src/migrator/full_migration.py @@ -179,7 +179,7 @@ class FullMigrator: 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 + pg_conn, final_count, final_last_id, migration_start_time, is_final=True ) logger.info(f"Migration state update complete") @@ -244,7 +244,8 @@ class FullMigrator: pg_conn: PostgreSQLConnector, rows_migrated: int, last_id: Optional[int] = None, - migration_start_time: Optional[str] = None + migration_start_time: Optional[str] = None, + is_final: bool = False ) -> None: """Update migration state in PostgreSQL and state file. @@ -253,10 +254,11 @@ class FullMigrator: rows_migrated: Total number of rows migrated so far last_id: Last ID that was migrated (for resume capability) migration_start_time: When the migration started (ISO format) + is_final: If True, mark migration as completed """ pg_table = self.config["postgres_table"] now = datetime.utcnow() - status = "in_progress" if last_id is not None else "completed" + status = "completed" if is_final else "in_progress" # Update PostgreSQL migration_state table try: