perf(db): 增加查询索引并提升 redo log 容量
This commit is contained in:
@@ -259,6 +259,9 @@ class Account(Base):
|
||||
archived_at: Mapped[datetime | None] = mapped_column(UTCDateTime, nullable=True)
|
||||
|
||||
__table_args__ = (
|
||||
# Account-name lookup is used by imports, task creation and support
|
||||
# searches. Usernames are not unique in legacy data.
|
||||
Index("ix_accounts_username_id", "username", "id"),
|
||||
# 巡检按「最久没查的优先」选行
|
||||
Index("ix_accounts_ck_checked_at", "ck_checked_at"),
|
||||
# 重登按状态 + 退避时间选行
|
||||
@@ -1649,6 +1652,8 @@ class AuditLog(Base):
|
||||
success: Mapped[bool | None] = mapped_column(Boolean, nullable=True, index=True)
|
||||
created_at: Mapped[datetime] = mapped_column(UTCDateTime, default=_utcnow)
|
||||
|
||||
__table_args__ = (Index("ix_audit_logs_target_id", "target", "id"),)
|
||||
|
||||
|
||||
class AccountEvent(Base):
|
||||
"""账号事件流(append-only)。
|
||||
|
||||
Reference in New Issue
Block a user