Commit Graph

2 Commits

Author SHA1 Message Date
49dbd98bff fix: Add last_completed_partition column to migration_state table schema
The migration_state table was missing the last_completed_partition column
that was referenced in the migration update queries. This column tracks
which partition was last completed to enable accurate resume capability.

To apply this change to existing databases:
  ALTER TABLE migration_state ADD COLUMN last_completed_partition VARCHAR(255);

For new databases, the table will be created with the column automatically.
2025-12-26 11:39:30 +01:00
2834f8b578 fix: Remove unsupported constraints from partitioned tables
PostgreSQL doesn't support PRIMARY KEY or UNIQUE constraints on
partitioned tables when using RANGE partitioning on expressions
(like EXTRACT(YEAR FROM event_date)).

Changed:
- RAWDATACOR: removed PRIMARY KEY (id, event_date) and UNIQUE constraint
- ELABDATADISP: removed PRIMARY KEY (id_elab_data, event_date) and UNIQUE constraint
- Tables now have no constraints except NOT NULL on required columns

This is a PostgreSQL limitation with partitioned tables.
Constraints can be added per-partition if needed, but for simplicity
we rely on application-level validation.

Fixes: 'vincolo PRIMARY KEY non supportato con una definizione di chiave di partizione'
2025-12-10 20:18:20 +01:00