fix: enum 写入 PG 用 value 而非 name

Source/SourceKind、UserRole、SubscriptionMatch 三个 enum 改用 values_callable
保证 PG 看到 'rss' / 'owner' / 'any' 等小写 value,而非 'RSS' 大写 name。
seed_sources 同步改为显式字符串。
This commit is contained in:
Mavis
2026-06-07 23:11:32 +08:00
parent 427e1f5cf2
commit 6635b8fea8
5 changed files with 37 additions and 23 deletions

View File

@@ -34,7 +34,11 @@ class Subscription(Base):
keyword: Mapped[str] = mapped_column(String(255), nullable=False)
# 简单关键词,匹配走 ILIKE '%kw%';后续可加 regex/lucene
match_in: Mapped[SubscriptionMatch] = mapped_column(
Enum(SubscriptionMatch, name="subscription_match"),
Enum(
SubscriptionMatch,
name="subscription_match",
values_callable=lambda x: [e.value for e in x],
),
default=SubscriptionMatch.ANY,
nullable=False,
)