fix: remove teams foreign key constraint from UserFact

- Remove FK constraint from UserFact.team_id (teams table may not exist)
- Update SQL migration to remove FK constraint
- team_id remains optional String field without FK
This commit is contained in:
Apple
2025-11-15 12:01:06 -08:00
parent b1a80b8fed
commit 7afcffd0bd
2 changed files with 2 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ class UserFact(Base):
id = Column(UUID(as_uuid=False), primary_key=True, server_default=func.gen_random_uuid())
user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True)
team_id = Column(String, ForeignKey("teams.id", ondelete="CASCADE"), nullable=True, index=True)
team_id = Column(String, nullable=True, index=True) # Без FK constraint, оскільки teams може не існувати
# Ключ факту (наприклад: "language", "is_donor", "is_validator", "top_contributor")
fact_key = Column(String, nullable=False, index=True)