-- v6 -> v7 (compatible with v1+): The files of encrypted rooms to write down at the API, and their pictures -- What the bridge writes down at the Xessenger API about the files of its encrypted rooms -- (mediarefs.go, docs/e2ee/work-plan.md 4.12) until the API took it, by room, event and part: the -- event's files (event), an edit's of it (edit:), the attachments its mail composition -- lists (mail), the composition itself -- while its mail.json is still to be read, whose keys composition keeps sealed (compose), or that the -- event was redacted (delete). The media IDs, a JSON list, are what the API keeps of the event in the -- end. state_slot is the outer state key of the encrypted state a picture belongs to; origin_ts when the -- event was sent, in ms; queued_at when the row came, in ns, which orders what is sent. CREATE TABLE xessenger_e2ee_media_ref ( bridge_id TEXT NOT NULL, room_id TEXT NOT NULL, event_id TEXT NOT NULL, part TEXT NOT NULL, media_ids TEXT NOT NULL, origin_ts BIGINT NOT NULL, state_slot TEXT, composition TEXT, queued_at BIGINT NOT NULL, PRIMARY KEY (bridge_id, room_id, event_id, part) ); CREATE INDEX xessenger_e2ee_media_ref_queued_idx ON xessenger_e2ee_media_ref (bridge_id, queued_at); -- The copy of a picture each encrypted state slot of a room shows (media.go, slotPicture), made for the -- slot alone and given again only while the slot shows it: the API deletes a copy once no row names it, -- and may still be deleting one a slot let go of. source_mxc is the picture as bridgev2 knows it, -- sealed_file the copy's EncryptedFileInfo, sealed. CREATE TABLE xessenger_e2ee_slot_picture ( bridge_id TEXT NOT NULL, room_id TEXT NOT NULL, slot TEXT NOT NULL, source_mxc TEXT NOT NULL, sealed_file TEXT NOT NULL, PRIMARY KEY (bridge_id, room_id, slot) );