TODO(cian): Add indexes on chats(archived, updated_at) and chat_files(created_at) for purge query performance. See: https://github.com/coder/internal/issues/1438 Deletes chat files that are older than the given threshold and are not referenced by any chat that is still active or was archived within
(ctx context.Context, arg DeleteOldChatFilesParams)
| 181 | // 2. Files whose every referencing chat has been archived for longer |
| 182 | // than the retention period. |
| 183 | DeleteOldChatFiles(ctx context.Context, arg DeleteOldChatFilesParams) (int64, error) |
| 184 | // Deletes chats that have been archived for longer than the given |
| 185 | // threshold. Active (non-archived) chats are never deleted. |
| 186 | // Related chat_messages, chat_diff_statuses, and |
no outgoing calls