feat(fc3b): migration 0011 — credential schema aligned with GS wire fields

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 18:32:52 -04:00
parent bf828c7b9d
commit e623e97be2
3 changed files with 81 additions and 3 deletions
+8 -3
View File
@@ -1,5 +1,8 @@
"""Credential — encrypted blob (cookies/token/oauth) scoped per-platform,
"""Credential — encrypted blob (cookies/token) scoped per-platform,
not per-source. One Patreon credential serves every Patreon source.
Schema aligned with GallerySubscriber's wire format (FC-3b) so the
existing browser extension hits FC unmodified.
"""
from datetime import datetime
@@ -15,10 +18,12 @@ class Credential(Base):
id: Mapped[int] = mapped_column(Integer, primary_key=True)
platform: Mapped[str] = mapped_column(String(64), nullable=False, unique=True)
kind: Mapped[str] = mapped_column(String(32), nullable=False) # cookies|token|oauth
credential_type: Mapped[str] = mapped_column(String(32), nullable=False) # cookies|token
encrypted_blob: Mapped[bytes] = mapped_column(LargeBinary, nullable=False)
status: Mapped[str] = mapped_column(String(32), nullable=False, default="active")
captured_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, server_default=func.now()
)
expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
last_verified: Mapped[datetime | None] = mapped_column(
DateTime(timezone=True), nullable=True
)