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:
@@ -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)
|
||||
|
||||
@@ -9,7 +9,7 @@ CREATE EXTENSION IF NOT EXISTS "vector";
|
||||
CREATE TABLE IF NOT EXISTS user_facts (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
team_id TEXT REFERENCES teams(id) ON DELETE CASCADE,
|
||||
team_id TEXT, -- Без FK constraint, оскільки teams може не існувати
|
||||
|
||||
-- Ключ факту (наприклад: "language", "is_donor", "is_validator", "top_contributor")
|
||||
fact_key TEXT NOT NULL,
|
||||
|
||||
Reference in New Issue
Block a user