fix: move CheckConstraint to __table_args__ in AgentMemoryEvent model
- Fix syntax error on line 115-116 - Move CheckConstraint from Column parameters to __table_args__ - Add proper constraint names
This commit is contained in:
@@ -109,18 +109,10 @@ class AgentMemoryEvent(Base):
|
|||||||
user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=True, index=True)
|
user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=True, index=True)
|
||||||
|
|
||||||
# Scope: short_term, mid_term, long_term
|
# Scope: short_term, mid_term, long_term
|
||||||
scope = Column(
|
scope = Column(String, nullable=False)
|
||||||
String,
|
|
||||||
nullable=False,
|
|
||||||
CheckConstraint("scope IN ('short_term', 'mid_term', 'long_term')")
|
|
||||||
)
|
|
||||||
|
|
||||||
# Kind: message, fact, summary, note
|
# Kind: message, fact, summary, note
|
||||||
kind = Column(
|
kind = Column(String, nullable=False)
|
||||||
String,
|
|
||||||
nullable=False,
|
|
||||||
CheckConstraint("kind IN ('message', 'fact', 'summary', 'note')")
|
|
||||||
)
|
|
||||||
|
|
||||||
# Тіло події
|
# Тіло події
|
||||||
body_text = Column(Text, nullable=True)
|
body_text = Column(Text, nullable=True)
|
||||||
@@ -129,6 +121,8 @@ class AgentMemoryEvent(Base):
|
|||||||
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=func.now())
|
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=func.now())
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
CheckConstraint("scope IN ('short_term', 'mid_term', 'long_term')", name="ck_agent_memory_scope"),
|
||||||
|
CheckConstraint("kind IN ('message', 'fact', 'summary', 'note')", name="ck_agent_memory_kind"),
|
||||||
Index("idx_agent_memory_events_agent_team_scope", "agent_id", "team_id", "scope"),
|
Index("idx_agent_memory_events_agent_team_scope", "agent_id", "team_id", "scope"),
|
||||||
Index("idx_agent_memory_events_channel", "agent_id", "channel_id"),
|
Index("idx_agent_memory_events_channel", "agent_id", "channel_id"),
|
||||||
Index("idx_agent_memory_events_created_at", "created_at"),
|
Index("idx_agent_memory_events_created_at", "created_at"),
|
||||||
|
|||||||
Reference in New Issue
Block a user