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:
@@ -32,7 +32,11 @@ class Source(Base):
|
||||
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
slug: Mapped[str] = mapped_column(String(128), unique=True, index=True, nullable=False)
|
||||
kind: Mapped[SourceKind] = mapped_column(
|
||||
Enum(SourceKind, name="source_kind"),
|
||||
Enum(
|
||||
SourceKind,
|
||||
name="source_kind",
|
||||
values_callable=lambda x: [e.value for e in x],
|
||||
),
|
||||
default=SourceKind.RSS,
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user