Files
coder/coderd/database/migrations/000477_chat_auto_archive.up.sql
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
497 B
SQL
Raw Normal View History

-- Partial index matching the AutoArchiveInactiveChats WHERE clause so
-- dbpurge can skip the bulk of archived / pinned / child chats.
-- The status predicate lives in the query, not the index, because
-- enum values added by earlier migrations cannot be referenced in
-- index predicates within the same transaction batch.
CREATE INDEX IF NOT EXISTS idx_chats_auto_archive_candidates
ON chats (created_at)
WHERE archived = false
AND pin_order = 0
AND parent_chat_id IS NULL;