//// ------------------------------------------------------ //// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) //// ------------------------------------------------------ Table users { id String [pk] email String [unique, not null] password String username String [unique, not null] fullname String [not null] avatar String bio String datebirth DateTime role user_role [not null, default: 'user'] sex user_sex phone_number String country countries auth_provider String provider_token String address user_addresses preferences user_preferences created_at DateTime [default: `now()`, not null] updated_at DateTime [not null] deleted_at DateTime countryId String oauth_accounts user_oauth_accounts [not null] sessions user_sessions [not null] followers user_follows [not null] following user_follows [not null] provisioned_as_admin provisioned_users [not null] provisioned_as_user provisioned_users [not null] created_producers producers [not null] submitted_media media_submissions [not null] reviewed_media media_submissions [not null] updated_media medias [not null] deleted_media medias [not null] created_episodes episodes [not null] submitted_videos video_submissions [not null] reviewed_videos video_submissions [not null] submitted_video_services video_service_submissions [not null] reviewed_video_services video_service_submissions [not null] comments comments [not null] comment_likes comment_likes [not null] comment_audit_logs comment_audit_logs [not null] comment_reports comment_reports [not null] home_media_banners home_media_banners [not null] watch_histories user_watch_histories [not null] saved_collections collection_members [not null] invited_collections collection_members [not null] contributed_collections media_collections [not null] Note: '* * ---------------------------------- * Model for User and related entities * ----------------------------------' } Table user_addresses { user_id String [pk] address String [not null] district String [not null] city String [not null] province String [not null] postal_code String [not null] coordinate String updated_at DateTime [not null] user users [not null] } Table user_oauth_accounts { id String [pk] user users [not null] provider_name auth_provider [not null] provider_sub String provider_email String provider_token String refresh_token String expires_at DateTime last_login DateTime [default: `now()`, not null] created_at DateTime [default: `now()`, not null] updated_at DateTime [not null] user_id String [not null] } Table user_sessions { id String [pk] user users [not null] device_type device_type [not null] os_type String os_version String browser_name String browser_version String ip_login String login_at DateTime [default: `now()`, not null] logout_at DateTime user_id String [not null] } Table user_preferences { user users [not null] char_as_partner characters [not null] comment_picture String enable_watch_history Boolean [not null, default: true] enable_search_history Boolean [not null, default: false] is_private_account Boolean [not null, default: false] can_message_me Boolean [not null, default: true] publish_birthday Boolean [not null, default: false] publish_email Boolean [not null, default: false] publish_phone_number Boolean [not null, default: false] publish_country Boolean [not null, default: false] publish_partner Boolean [not null, default: true] subscribe_to_newsletter Boolean [not null, default: true] enable_security_alerts Boolean [not null, default: true] genre_preferences user_genre_preferences [not null] rating_preferences user_rating_preferences [not null] country_preferences user_country_preferences [not null] user_id String [pk] char_as_partner_id String [not null] } Table user_genre_preferences { user user_preferences [not null] genre genres [not null] state user_preference_state [not null] user_id String [not null] genre_id String [not null] indexes { (user_id, genre_id) [pk] } } Table user_rating_preferences { user user_preferences [not null] rating media_age_ratings [not null] state user_preference_state [not null] user_id String [not null] rating_id String [not null] indexes { (user_id, rating_id) [pk] } } Table user_country_preferences { user user_preferences [not null] country countries [not null] state user_preference_state [not null] user_id String [not null] country_id String [not null] indexes { (user_id, country_id) [pk] } } Table user_follows { follower users [not null] following users [not null] created_at DateTime [default: `now()`, not null] follower_id String [not null] following_id String [not null] indexes { (follower_id, following_id) [pk] } } Table user_watch_histories { user users [not null] episode episodes [not null] updated_at DateTime [not null] user_id String [not null] episode_id String [not null] indexes { (user_id, episode_id) [pk] } } Table collections { id String [pk] name String [not null] code String cover_url String privacy privacy_level [not null, default: 'private'] created_at DateTime [default: `now()`, not null] updated_at DateTime [not null] saved_media media_collections [not null] members collection_members [not null] } Table collection_members { collection collections [not null] user users [not null] access_level collection_access_level [not null] invited_by users invited_at DateTime collection_id String [not null] user_id String [not null] invited_by_id String indexes { (collection_id, user_id) [pk] } } Table medias { id String [pk] mal_id Int [unique, not null] title String [not null] title_secondary String title_original String title_synonyms String[] [not null] trailer media_trailers synopsis String small_image_url String medium_image_url String [not null] large_image_url String type media_types [not null] source media_sources status media_statuses airing Boolean [not null] start_airing DateTime end_airing DateTime age_rating media_age_ratings score Decimal score_total Int [not null, default: 0] score_count Int [not null, default: 0] background String season media_season [not null] year Int country countries broadcast_day String producers media_producers [not null] licensors media_licensors [not null] studios media_studios [not null] genres media_genres [not null] explicit_genres media_explicit_genres [not null] themes media_themes [not null] demographics media_demographics [not null] relations media_relations [not null] external_links media_external_links [not null] characters media_characters [not null] submissions media_submissions created_at DateTime [default: `now()`, not null] updated_by users updated_at DateTime [not null] deleted_by users deleted_at DateTime type_id String [not null] source_id String [not null] status_id String [not null] age_rating_id String country_id String related_media media_relations [not null] approver_id String created_by_id String updated_by_id String deleted_by_id String home_media_banners home_media_banners [not null] saved_to_collections media_collections [not null] Note: '* * ---------------------------------- * Model for Media and related entities * ----------------------------------' } Table media_submissions { id String [pk] media medias [not null] submitter users [not null] status status_submission [not null, default: 'pending'] reviewer users reviewed_at DateTime reason String created_at DateTime [default: `now()`, not null] media_id String [unique, not null] submitter_id String [not null] reviewer_id String } Table media_collections { media medias [not null] collection collections [not null] added_by users [not null] added_at DateTime [default: `now()`, not null] media_id String [not null] collection_id String [not null] added_by_id String [not null] indexes { (media_id, collection_id) [pk] } } Table media_trailers { media_id String [pk] url String embed_url String small_image_url String large_image_url String maximum_image_url String media medias [not null] } Table media_types { id String [pk] name String [unique, not null] Media medias [not null] } Table media_sources { id String [pk] name String [unique, not null] media medias [not null] } Table media_statuses { id String [pk] name String [unique, not null] media medias [not null] } Table media_age_ratings { id String [pk] name String [unique, not null] min_age Int [not null] media medias [not null] user_rating_preferences user_rating_preferences [not null] } Table media_producers { media medias [not null] producer producers [not null] media_id String [not null] producer_id String [not null] indexes { (media_id, producer_id) [pk] } } Table media_licensors { media medias [not null] licensor producers [not null] media_id String [not null] licensor_id String [not null] indexes { (media_id, licensor_id) [pk] } } Table media_studios { media medias [not null] studio producers [not null] media_id String [not null] studio_id String [not null] indexes { (media_id, studio_id) [pk] } } Table producers { id String [pk] mal_id Int [unique, not null] type String [not null] name String [not null] url String created_by users [not null] created_at DateTime [default: `now()`, not null] updated_at DateTime [not null] deleted_at DateTime created_by_id String [not null] media_producers media_producers [not null] media_licensors media_licensors [not null] media_studios media_studios [not null] } Table media_genres { media medias [not null] genre genres [not null] media_id String [not null] genre_id String [not null] indexes { (media_id, genre_id) [pk] } } Table media_explicit_genres { media medias [not null] genre genres [not null] media_id String [not null] genre_id String [not null] indexes { (media_id, genre_id) [pk] } } Table media_themes { media medias [not null] theme genres [not null] media_id String [not null] genre_id String [not null] indexes { (media_id, genre_id) [pk] } } Table media_demographics { media medias [not null] demographic genres [not null] media_id String [not null] demographic_id String [not null] indexes { (media_id, demographic_id) [pk] } } Table genres { id String [pk] mal_id Int [unique, not null] name String [not null] slug String [not null] thumbnail_url String media_genres media_genres [not null] media_explicit_genres media_explicit_genres [not null] media_themes media_themes [not null] media_demographics media_demographics [not null] user_genre_preferences user_genre_preferences [not null] } Table media_relations { media medias [not null] related_media medias [not null] relation_type String [not null] media_id String [not null] related_media_id String [not null] indexes { (media_id, related_media_id) [pk] } } Table media_external_links { id String [pk] media medias [not null] url String [not null] site_name String media_id String [not null] } Table media_characters { id String [pk] media medias [not null] character characters [not null] voice_actors voice_actors [not null] role character_role [not null] media_id String [not null] character_id String [not null] } Table characters { id String [pk] name String [not null] image String small_image String mal_id Int [unique] fanpage_url String liked Int [not null, default: 0] deleted_at DateTime updated_at DateTime [not null] created_at DateTime [default: `now()`, not null] partnered_user user_preferences [not null] media_characters media_characters [not null] } Table voice_actors { id String [pk] media_character_id String [not null] language String [not null] actor_staff staff [not null] staff_id String [not null] media_character media_characters [not null] } Table staff { id String [pk] name String [not null] image String mal_id Int [unique] deleted_at DateTime updated_at DateTime [not null] created_at DateTime [default: `now()`, not null] voice_actors voice_actors [not null] } Table episodes { id String [pk] media_id String [not null] episode Int [not null] mal_url String forum_url String title String [not null] title_origin String title_romanji String aired_at DateTime filler Boolean [not null] recap Boolean [not null] total_score Int [not null, default: 0] score_count Int [not null, default: 0] deleted_at DateTime updated_at DateTime [not null] created_at DateTime [default: `now()`, not null] created_by users [not null] videos videos [not null] created_by_id String [not null] comments comments [not null] watch_histories user_watch_histories [not null] } Table videos { id String [pk] service video_services [not null] Episode episodes [not null] video_code String [not null] short_code String thumbnail_code String download_code String created_at DateTime [default: `now()`, not null] deleted_at DateTime updated_at DateTime [not null] episode_id String [not null] created_by_id String [not null] video_submission video_submissions } Table video_submissions { video_id String [pk] created_by users [not null] reviewer users status status_submission [not null, default: 'pending'] reviewed_at DateTime reason String created_at DateTime [default: `now()`, not null] created_by_id String [not null] reviewer_id String video videos [not null] } Table video_services { id String [pk] name String [not null] resolution Int [not null] domain String [not null] image_url String hex_color String endpoint_video String [not null] endpoint_short String endpoint_image String endpoint_download String deleted_at DateTime updated_at DateTime [not null] created_at DateTime [default: `now()`, not null] videos videos [not null] video_service_submissions video_service_submissions indexes { (name, resolution) [unique] } } Table video_service_submissions { video_service_id String [pk] created_by users [not null] status status_submission [not null, default: 'pending'] reviewer users reviewed_at DateTime reason String created_at DateTime [default: `now()`, not null] video_service video_services [not null] created_by_id String [not null] reviewer_id String } Table comments { id String [pk] user users [not null] episode episodes [not null] content String [not null] created_at DateTime [default: `now()`, not null] updated_at DateTime [not null] deleted_at DateTime user_id String [not null] episode_id String [not null] likes comment_likes [not null] audit_logs comment_audit_logs [not null] reports comment_reports [not null] } Table comment_likes { user_id String [not null] comment_id String [not null] type like_type [not null] created_at DateTime [default: `now()`, not null] user users [not null] comment comments [not null] indexes { (user_id, comment_id) [pk] } } Table comment_audit_logs { id String [pk] comment comments [not null] performed_by users [not null] action audit_action [not null] created_at DateTime [default: `now()`, not null] comment_id String [not null] performed_by_id String [not null] } Table comment_reports { id String [pk] reporter users [not null] comment comments [not null] title String [not null] status status_submission [not null] description String reported_at DateTime [default: `now()`, not null] closed_at DateTime reporter_id String [not null] comment_id String [not null] } Table provisioned_users { provisioned_by users [not null] provisioned_to users [not null] provisioned_at DateTime [default: `now()`, not null] reason String admin_id String [not null] user_id String [not null] indexes { (admin_id, user_id) [pk] } Note: '* * ---------------------------------- * Model for System Apps and related entities * ----------------------------------' } Table countries { id String [pk] name String [not null] slug String [not null] code String [not null] flag String banner String UserCountry users [not null] UserCountryPreference user_country_preferences [not null] Media medias [not null] } Table home_media_banners { id String [pk] media medias [not null] created_by users [not null] priority Int [unique, not null] start_show DateTime [not null] end_show DateTime [not null] created_at DateTime [default: `now()`, not null] media_id String [not null] created_by_id String [not null] } Table VideoToVideoService { serviceId String [ref: > video_services.id] videosId String [ref: > videos.id] } Enum user_role { user contributor curator admin } Enum user_sex { male female } Enum auth_provider { google github } Enum device_type { mobile tablet desktop unknown } Enum user_preference_state { exclude include } Enum media_season { winter spring summer fall } Enum character_role { main supporting background } Enum status_submission { pending approved rejected } Enum like_type { like dislike } Enum audit_action { delete restore edit flag } Enum privacy_level { public unlisted private } Enum collection_access_level { owner moderator contributor viewer } Ref: users.countryId > countries.id Ref: user_addresses.user_id - users.id Ref: user_oauth_accounts.user_id > users.id Ref: user_sessions.user_id > users.id Ref: user_preferences.user_id - users.id Ref: user_preferences.char_as_partner_id > characters.id Ref: user_genre_preferences.user_id > user_preferences.user_id Ref: user_genre_preferences.genre_id > genres.id Ref: user_rating_preferences.user_id > user_preferences.user_id Ref: user_rating_preferences.rating_id > media_age_ratings.id Ref: user_country_preferences.user_id > user_preferences.user_id Ref: user_country_preferences.country_id > countries.id Ref: user_follows.follower_id > users.id Ref: user_follows.following_id > users.id Ref: user_watch_histories.user_id > users.id Ref: user_watch_histories.episode_id > episodes.id Ref: collection_members.collection_id > collections.id Ref: collection_members.user_id > users.id Ref: collection_members.invited_by_id > users.id Ref: medias.type_id > media_types.id Ref: medias.source_id > media_sources.id Ref: medias.status_id > media_statuses.id Ref: medias.age_rating_id > media_age_ratings.id Ref: medias.country_id > countries.id Ref: medias.updated_by_id > users.id Ref: medias.deleted_by_id > users.id Ref: media_submissions.media_id - medias.id Ref: media_submissions.submitter_id > users.id Ref: media_submissions.reviewer_id > users.id Ref: media_collections.media_id > medias.id Ref: media_collections.collection_id > collections.id Ref: media_collections.added_by_id > users.id Ref: media_trailers.media_id - medias.id Ref: media_producers.media_id > medias.id Ref: media_producers.producer_id > producers.id Ref: media_licensors.media_id > medias.id Ref: media_licensors.licensor_id > producers.id Ref: media_studios.media_id > medias.id Ref: media_studios.studio_id > producers.id Ref: producers.created_by_id > users.id Ref: media_genres.media_id > medias.id Ref: media_genres.genre_id > genres.id Ref: media_explicit_genres.media_id > medias.id Ref: media_explicit_genres.genre_id > genres.id Ref: media_themes.media_id > medias.id Ref: media_themes.genre_id > genres.id Ref: media_demographics.media_id > medias.id Ref: media_demographics.demographic_id > genres.id Ref: media_relations.media_id > medias.id Ref: media_relations.related_media_id > medias.id Ref: media_external_links.media_id > medias.id Ref: media_characters.media_id > medias.id Ref: media_characters.character_id > characters.id Ref: voice_actors.staff_id > staff.id Ref: voice_actors.media_character_id > media_characters.id Ref: episodes.created_by_id > users.id Ref: videos.episode_id > episodes.id Ref: video_submissions.created_by_id > users.id Ref: video_submissions.reviewer_id > users.id Ref: video_submissions.video_id - videos.id Ref: video_service_submissions.created_by_id > users.id Ref: video_service_submissions.reviewer_id > users.id Ref: video_service_submissions.video_service_id - video_services.id Ref: comments.user_id > users.id Ref: comments.episode_id > episodes.id Ref: comment_likes.user_id > users.id Ref: comment_likes.comment_id > comments.id Ref: comment_audit_logs.comment_id > comments.id Ref: comment_audit_logs.performed_by_id > users.id Ref: comment_reports.reporter_id > users.id Ref: comment_reports.comment_id > comments.id Ref: provisioned_users.admin_id > users.id Ref: provisioned_users.user_id > users.id Ref: home_media_banners.media_id > medias.id Ref: home_media_banners.created_by_id > users.id