Fix pension_schedule table schema to support multiple vesting milestones per pension

- Changed primary key from composite (file_no, version) to auto-increment id
- A pension can have multiple vesting schedule entries (e.g., vests 20% at year 1, 100% at year 5)
- Added index on (file_no, version) for efficient lookups
- Successfully imported 502 vesting schedule entries for 416 unique pensions
- Some pensions have up to 6 vesting milestones
This commit is contained in:
HotSwapp
2025-10-13 08:54:19 -05:00
parent ac98bded69
commit 83a3959906
17 changed files with 28513 additions and 2 deletions

View File

@@ -662,13 +662,15 @@ class PensionSchedule(Base):
"""SCHEDULE vesting schedule for pensions."""
__tablename__ = "pension_schedule"
file_no = Column(String, primary_key=True)
version = Column(String, primary_key=True)
id = Column(Integer, primary_key=True, autoincrement=True)
file_no = Column(String, nullable=False)
version = Column(String, nullable=False)
vests_on = Column(Date)
vests_at = Column(Numeric(12, 2))
__table_args__ = (
ForeignKeyConstraint(["file_no", "version"], ["pensions.file_no", "pensions.version"], ondelete="CASCADE"),
Index("ix_pension_schedule_file_version", "file_no", "version"),
)