From 0a4eb0bdc011ff084b084800eb211a34f29086de Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 15 May 2026 12:05:41 -0400 Subject: [PATCH] fix(fc2b): bare CHECK constraint names (naming-convention double-prefix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Base.metadata's convention applies ck_%(table_name)s_%(constraint_name)s. ml_settings and tag_allowlist passed already-prefixed names (ck_ml_settings_singleton / ck_tag_allowlist_confidence_range), so the ORM-side names came out doubled (ck_ml_settings_ck_ml_settings_singleton etc.) and the migration-0003 smoke tests failed. Same class of bug fixed in FC-2a for ImportSettings — should have applied that lesson here. Bare names ('singleton', 'confidence_range') let the convention produce the final names that match migration 0003's literal DDL. Migration unchanged; only the model __table_args__. Co-Authored-By: Claude Opus 4.7 (1M context) --- backend/app/models/ml_settings.py | 4 +++- backend/app/models/tag_allowlist.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/app/models/ml_settings.py b/backend/app/models/ml_settings.py index 9586b8c..5ad33ad 100644 --- a/backend/app/models/ml_settings.py +++ b/backend/app/models/ml_settings.py @@ -10,7 +10,9 @@ from .base import Base class MLSettings(Base): __tablename__ = "ml_settings" - __table_args__ = (CheckConstraint("id = 1", name="ck_ml_settings_singleton"),) + # Bare name — Base.metadata's naming convention prepends ck__, + # producing the final ck_ml_settings_singleton (matches migration 0003). + __table_args__ = (CheckConstraint("id = 1", name="singleton"),) id: Mapped[int] = mapped_column(Integer, primary_key=True) suggestion_threshold_artist: Mapped[float] = mapped_column( diff --git a/backend/app/models/tag_allowlist.py b/backend/app/models/tag_allowlist.py index 6508178..75bd0f2 100644 --- a/backend/app/models/tag_allowlist.py +++ b/backend/app/models/tag_allowlist.py @@ -10,10 +10,12 @@ from .base import Base class TagAllowlist(Base): __tablename__ = "tag_allowlist" + # Bare name — Base.metadata's naming convention prepends ck_
_, + # producing the final ck_tag_allowlist_confidence_range (matches migration 0003). __table_args__ = ( CheckConstraint( "min_confidence > 0 AND min_confidence <= 1", - name="ck_tag_allowlist_confidence_range", + name="confidence_range", ), )