alembic: 0023 — users.lang index + widen quotes_daily.symbol
Two related schema fixes from the code review: - users.lang gets a single-column index. The ai_log_job and email_digest_job both SELECT DISTINCT on this column every cycle; even at low cardinality an index is the right shape. - quotes_daily.symbol widened to VARCHAR(128) to match quotes.symbol (widened back in 0005). Long Eurostat/ONS symbols would silently truncate during rollup otherwise. Models updated to match (User.lang gains index=True, QuoteDaily.symbol goes to String(128)). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
308878749f
commit
eb31d09782
2 changed files with 40 additions and 1 deletions
|
|
@ -59,7 +59,7 @@ class Quote(Base):
|
|||
class QuoteDaily(Base):
|
||||
"""Daily rollup — sparkline source. PK on (symbol, date)."""
|
||||
__tablename__ = "quotes_daily"
|
||||
symbol: Mapped[str] = mapped_column(String(64), primary_key=True)
|
||||
symbol: Mapped[str] = mapped_column(String(128), primary_key=True)
|
||||
date: Mapped[date] = mapped_column(Date, primary_key=True)
|
||||
close: Mapped[float | None] = mapped_column(Float)
|
||||
high: Mapped[float | None] = mapped_column(Float)
|
||||
|
|
@ -228,6 +228,7 @@ class User(Base):
|
|||
# app/services/i18n.py before writing.
|
||||
lang: Mapped[str] = mapped_column(
|
||||
String(8), nullable=False, default="en", server_default="en",
|
||||
index=True,
|
||||
)
|
||||
# Polar (MoR) linkage — populated by the polar_webhook handler the
|
||||
# first time we see a subscription/order event for the user. The
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue