Wondering the best way to architect a scrapbook application that has different content types/templates: Text, Video, Image, Gif etc. A page can contain any number of content types ex:
A Collage Template can have 3 images, a video, and some text on it.
Do I have a separate table for each type? How does the page know what table to look up? Does it have to scan each table?
Here's what I have but not sure how to piece it together. Seems like a lot of tables and a lot of lookups and redundancy, so do I have to lookup each table for items that match page_id? Would a join do this in one round trip? Would a jsonb column make sense? If I had say 20 different content types, this would be a lot to keep track of. Is there a more generic/universal way of doing it?
Thanks!
Table: pages
id created_at created_by page_type hashtags Table: text
id text font dimensions coordinates color opacity rotation url Table: video
id page_id video_url dimensions coordinates opacity rotation duration transcription url Table: image
id page_id image_url dimensions coordinates opacity rotation -url Table: gif -id -page_id -gif_url
dimensions coordinates opacity rotation url Table: audio -id -page_id -audio_url -duration -transcription -url
**Updated with more fields and changed from messaging to scrapbook for better explanation