perf: add indexed notification summaries and widget

This commit is contained in:
2026-07-29 14:16:29 +02:00
parent 992d2ca533
commit e32ba3663b
9 changed files with 312 additions and 36 deletions
@@ -19,6 +19,14 @@ class NotificationMessage(Base, TimestampMixin):
__table_args__ = (
Index("ix_notification_messages_tenant_status", "tenant_id", "status"),
Index("ix_notification_messages_tenant_recipient", "tenant_id", "recipient_type", "recipient_id"),
Index(
"ix_notification_messages_summary",
"tenant_id",
"recipient_id",
"deleted_at",
"status",
"read_at",
),
Index("ix_notification_messages_source", "tenant_id", "source_module", "source_resource_type", "source_resource_id"),
Index("ix_notification_messages_due", "tenant_id", "status", "not_before_at"),
)