fix: When --partition is specified, ignore migration_state partition tracking

Problem: When using --partition to test a specific partition, the code would
still read last_completed_partition from migration_state and skip partitions
based on that, potentially skipping the requested partition.

Solution: When partition parameter is specified, set last_completed_partition
to None to force processing the requested partition regardless of what's in
migration_state.

This ensures --partition works as expected:
- python3 main.py migrate full --table ELABDATADISP --partition d10 --resume
  Will process ONLY d10, not resume from migration_state partition tracking

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-27 09:45:15 +01:00
parent f3768d8174
commit 3576a8f354

View File

@@ -71,6 +71,12 @@ class FullMigrator:
# - Full restart requires clearing the table
previous_migrated_count = self._get_previous_migrated_count(pg_conn, pg_table)
# If specific partition requested, ignore migration_state partition tracking
# and start fresh for that partition
if partition:
last_completed_partition = None
logger.info(f"Specific partition {partition} requested - ignoring migration_state partition tracking")
else:
last_completed_partition = self._get_last_completed_partition(pg_conn, pg_table)
if previous_migrated_count > 0: