post_media table
The post_media table in the Reddit Clone Database Schema schema has 6 columns, keyed by id, with 2 foreign keys to posts and media_assets.
One row per gallery item, pointing at a reusable asset rather than a URL, so the same upload can be crossposted without being re-encoded.
Columns (6)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| post_id | uuid | not null, references posts.id | |
| media_asset_id | uuid | not null, references media_assets.id | |
| caption | varchar(300) | ||
| outbound_url | varchar(2000) | ||
| position | smallint | not null |
Indexes (1)
(post_id, position)
Relationships
post_media.post_idreferencesposts.idpost_media.media_asset_idreferencesmedia_assets.id