Archives inactive root chats (pinned and already-archived chats skipped), cascading to children via root_chat_id. Limits apply to roots, not total rows. The Go caller passes @archive_cutoff as UTC midnight so that all chats sharing the same last-activity date are archived together. Used by dbpurge.
(ctx context.Context, arg AutoArchiveInactiveChatsParams)
| 71 | // created_at ASC flows through to dbpurge's digest truncation; see |
| 72 | // buildDigestData in dbpurge.go for the tradeoff rationale. |
| 73 | AutoArchiveInactiveChats(ctx context.Context, arg AutoArchiveInactiveChatsParams) ([]AutoArchiveInactiveChatsRow, error) |
| 74 | // old_provider is matched as text; new_provider is also cast to ai_provider_type |
| 75 | // for the EXISTS check against ai_providers.type. |
| 76 | // ai_provider_id IS NOT NULL is defensive; the check constraint already |
no outgoing calls