-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: evict the oldest attachments at the chat file cap #29063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c53499b
8ee2eeb
904d801
e59768c
a951b85
f8ce109
5715f8f
6c5de89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| CREATE INDEX idx_chat_file_links_file_id ON chat_file_links (file_id); | ||
|
|
||
| ALTER TABLE chat_file_links | ||
| DROP CONSTRAINT chat_file_links_file_id_key; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| -- A file belongs to one chat. Drop any duplicate links, keeping the link on | ||
| -- the oldest chat, before enforcing it. | ||
| DELETE FROM chat_file_links l | ||
| USING chat_file_links o, chats lc, chats oc | ||
| WHERE o.file_id = l.file_id | ||
| AND lc.id = l.chat_id | ||
| AND oc.id = o.chat_id | ||
| AND (oc.created_at, oc.id) < (lc.created_at, lc.id); | ||
|
|
||
| ALTER TABLE chat_file_links | ||
| ADD CONSTRAINT chat_file_links_file_id_key UNIQUE (file_id); | ||
|
|
||
| -- The unique index replaces the purge lookup index. | ||
| DROP INDEX idx_chat_file_links_file_id; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.