Merge branch 'main' into dev
# Conflicts: # tests/test_migrations.py
This commit is contained in:
@@ -9,6 +9,7 @@ from sqlalchemy import (
|
||||
BigInteger,
|
||||
Boolean,
|
||||
ForeignKey,
|
||||
Index,
|
||||
Integer,
|
||||
String,
|
||||
Text,
|
||||
@@ -215,6 +216,24 @@ class DouyuTask(Base):
|
||||
created_by: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(UTCDateTime, default=_utcnow)
|
||||
finished_at: Mapped[datetime | None] = mapped_column(UTCDateTime, nullable=True)
|
||||
# 账号归属客服冗余字段,配合复合索引消除任务列表全表 filesort。
|
||||
account_assigned_to: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("users.id"), nullable=True
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"ix_douyu_tasks_account_assigned_to_id",
|
||||
"account_assigned_to",
|
||||
"id",
|
||||
),
|
||||
Index(
|
||||
"ix_douyu_tasks_assigned_scope_id",
|
||||
"account_assigned_to",
|
||||
"handbook_scope",
|
||||
"id",
|
||||
),
|
||||
)
|
||||
|
||||
account: Mapped[Account] = relationship("Account", back_populates="douyu_tasks")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user