Files
spsays-bff/migrations/0051_quote_attachment.up.sql
T

19 lines
901 B
SQL

-- A shared passage from the library, sent into a chat.
--
-- Modelled as an attachment rather than message text so it can be rendered as
-- a quote and navigated back to. It reuses the columns the link card already
-- has, since the shape is the same thing said differently:
--
-- url → the ?hl= deep link back to the exact phrase
-- title → the source reference ("Bhagavad-gītā 2.13")
-- description → the quoted passage itself
--
-- It is a distinct kind rather than a 'link' because it renders as a quote,
-- not a preview card, and because its URL is always our own — the service
-- refuses any other origin.
ALTER TABLE message_attachments DROP CONSTRAINT IF EXISTS message_attachments_kind_check;
ALTER TABLE message_attachments
ADD CONSTRAINT message_attachments_kind_check
CHECK (kind IN ('image', 'video', 'audio', 'file', 'link', 'entity', 'quote'));