Entity Relationship Diagram
This page shows how the main Streamix tables relate. Column details are in Database Documentation. Notation: 1──< is one-to-many, >──< is many-to-many (through a join table), 0..1 is optional.
Catalogue
maturity_ratings 1──< titles
content_categories (type='genre') >──< titles via title_genres
tags (kind='mood') >──< titles via title_tags
people >──< titles via title_credits (role, character_name)
titles 1──< seasons 1──< episodes
titles 1──< episodes (episodes.title_id, for fast lookups)
titles 1──< artwork (boxart, poster, backdrop, logo, still)
titles 1──< trailers
Playable media
video_assets uses a polymorphic owner: (owner_type, owner_id) is unique, so each owner has at most one playable asset.
titles (type='movie') 1──0..1 video_assets owner_type='title'
episodes 1──0..1 video_assets owner_type='episode'
trailers 1──0..1 video_assets owner_type='trailer'
video_assets 1──< media_tracks (subtitles, captions, audio…)
Accounts, profiles and viewer state
customers 1──< profiles
avatars 1──< profiles (avatar_id, optional)
profiles >──< titles via my_list
profiles >──< titles via title_ratings (value -1 / 1 / 2)
profiles >──< titles via title_reminders
profiles >──< titles via profile_blocked_titles
profiles 1──< playback_progress >── titles
>── episodes (0..1; NULL for a movie)
profiles 1──< profile_notifications >── titles (0..1)
profiles 1──< profile_transfers >── customers (from_customer, to_customer)
Streams and devices
customers 1──< devices
customers 1──< playback_sessions
playback_sessions >── profiles (0..1) · devices (0..1) · titles (0..1) · episodes (0..1)
Billing
subscription_plans 1──< subscriptions
customers 1──< subscriptions
coupons 1──< subscriptions (coupon_id, optional)
subscriptions 1──< transactions
customers 1──< transactions
coupons 1──< coupon_redemptions >── customers
subscriptions keeps a snapshot of plan_name, price_cents and currency_code, so the link to subscription_plans is informational after purchase (ON DELETE SET NULL).
Merchandising and recommendations
titles 1──< billboards (page, optional genre_id → content_categories)
browse_rows >──< titles via browse_row_items (manual rows only)
content_categories 1──< browse_rows (genre pages, optional)
titles 1──< top10_snapshots
titles >──< titles via title_similar (title_id, similar_id)
Engagement and auth
customers 1──< customer_login_codes
customers 1──< customer_oauth_accounts
customers 1──< push_subscriptions >── profiles (0..1)
customers 1──< member_message_log
customers >──< notification templates via customer_notification_prefs (template_slug)
help_categories 1──< help_articles
Delete behaviour
| When you delete… | What happens |
|---|---|
| A title | Seasons, episodes, artwork, trailers, credits, genre/mood links, My List entries, ratings, reminders, progress, billboards, Top 10 rows and similar-title rows are removed (ON DELETE CASCADE). video_assets has no foreign key, so the admin delete route removes the title's, episodes' and trailers' asset rows explicitly. Files stay in the bucket. Sessions keep a NULL title. |
| A season | Its episodes are removed. |
A member (customers) |
Profiles and all per-profile state, devices, sessions, subscriptions and login codes are removed. Transactions keep a NULL customer_id. |
| A profile | My List, progress, ratings, reminders, notifications and blocked titles are removed. Sessions keep a NULL profile. |
| A plan | Subscriptions keep their snapshot; plan_id becomes NULL. |
| A genre | Title links and genre-scoped rows and billboards are removed. |
| A maturity rating | Titles keep maturity_rating_id = NULL (treated as level 0). |
© CreativeCape Solutions · creative-cape.com · support@creative-cape.com