diff --git a/alembic/versions/033_regime_fundamental_observations.py b/alembic/versions/033_regime_fundamental_observations.py index 1352add..c2d24f7 100644 --- a/alembic/versions/033_regime_fundamental_observations.py +++ b/alembic/versions/033_regime_fundamental_observations.py @@ -48,14 +48,17 @@ def upgrade() -> None: sa.Column("fetched_at", sa.DateTime(timezone=True), nullable=False), sa.Column("created_at", sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint( - "effective_date", name="uq_regime_fundamental_observations_effective_date" - ), ) + # One unique index, not a unique constraint plus a plain index: the model + # declares `unique=True, index=True`, which SQLAlchemy renders as exactly + # this. The constraint-plus-index pairing worked but left a redundant second + # index on the column and a permanent metadata diff for autogenerate to keep + # trying to reconcile. Matches RegimeSnapshot.date, the sibling table. op.create_index( "ix_regime_fundamental_observations_effective_date", "regime_fundamental_observations", ["effective_date"], + unique=True, ) diff --git a/tests/unit/test_event_study.py b/tests/unit/test_event_study.py index 0393923..dec509e 100644 --- a/tests/unit/test_event_study.py +++ b/tests/unit/test_event_study.py @@ -5,8 +5,6 @@ from __future__ import annotations from copy import deepcopy from datetime import date, timedelta -import pytest - from app.services.breadth_service import _breadth_from_closes, compute_divergence_series from app.services.event_study_service import ( MIN_EVENTS_FOR_CONFIDENCE,