HomePhabricator
Diffusion Comm e3e90c7670da

[lib] Introduce `MediaMessageServerDBContent` type

Description

[lib] Introduce MediaMessageServerDBContent type

Summary:
In the past we had a 1:many relationship between messages and media and a 1:1 relationship between media and uploads.

Now that we've introduced thumbnails for videos, the relationship between media and uploads is 1:many (well 1:1 or 1:2 for now).

We need some way to encode that multiple uploads correspond to the same media. One way to do this would be to introduce a media table where each entry corresponds to a Media and where the columns look something like | id | container | uploadID | thumbnailID |.

Personally I think that would be the cleanest approach since the database schema matches the relationship between messages, media, and uploads in the code.

However, what I previously discussed with @ashoat (and which he previously signed off on) was to encode the relationship between uploads for each piece of media in an object and serialize and store those in the content column of the messages database.

Here's an example of what the content column of the messages table will look like in the future:

Screen Shot 2022-08-30 at 4.27.36 PM.png (100×1 px, 43 KB)

Instead of a list of IDs, we have a list of MediaMessageServerDBContents which encode the relationship between entries in the uploads table.


Depends on D4982

Test Plan: NA, just introducing a type we have yet to use anywhere

Reviewers: abosh, tomek, jacek, ashoat

Reviewed By: abosh, tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D4985

Details

Provenance
atulAuthored on Aug 31 2022, 11:18 AM
Reviewer
abosh
Differential Revision
D4985: [lib] Introduce `MediaMessageServerDBContent` type
Parents
rCOMM2a3d2928af84: [keyserver] Add `--source-maps` flag to `babel-build` for more sane debugging…
Branches
Unknown
Tags
Unknown