572 lines
16 KiB
Plaintext
572 lines
16 KiB
Plaintext
Enum "audit_action" {
|
|
"delete"
|
|
"restore"
|
|
"edit"
|
|
"flag"
|
|
}
|
|
|
|
Enum "collection_access_level" {
|
|
"viewer"
|
|
"contributor"
|
|
"moderator"
|
|
"owner"
|
|
}
|
|
|
|
Enum "privacy_level" {
|
|
"private"
|
|
"unlisted"
|
|
"public"
|
|
}
|
|
|
|
Enum "status_submission" {
|
|
"pending"
|
|
"approved"
|
|
"rejected"
|
|
}
|
|
|
|
Enum "user_preference_state" {
|
|
"exclude"
|
|
"include"
|
|
}
|
|
|
|
Enum "user_role" {
|
|
"user"
|
|
"contributor"
|
|
"curator"
|
|
"administrator"
|
|
}
|
|
|
|
Enum "user_sex" {
|
|
"female"
|
|
"male"
|
|
}
|
|
|
|
Enum "like_type" {
|
|
"like"
|
|
"dislike"
|
|
}
|
|
|
|
Enum "device_type" {
|
|
"mobile"
|
|
"tablet"
|
|
"desktop"
|
|
"unknown"
|
|
}
|
|
|
|
Table "public"."user_rating_preferences" {
|
|
"user_id" uuid [unique, not null, ref: > "public"."user_preferences"."user_id"]
|
|
"rating_id" uuid [not null, ref: > "public"."media_age_ratings"."id"]
|
|
"state" user_preference_state [not null]
|
|
}
|
|
|
|
Table "public"."episodes" {
|
|
"id" uuid [pk, not null, ref: > "public"."medias"."episodes"]
|
|
"media_id" uuid [not null, ref: > "public"."medias"."id"]
|
|
"episode" smallint
|
|
"mal_url" varchar(255)
|
|
"mal_forum_url" varchar(255)
|
|
"title" varchar(155) [not null]
|
|
"title_origin" varchar(155)
|
|
"title_romanji" varchar(155)
|
|
"aired" date
|
|
"filler" boolean [not null, default: false]
|
|
"recap" boolean [not null, default: false]
|
|
"total_score" int [not null]
|
|
"scored_by" int [not null]
|
|
"videos" uuid
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."characters" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(255) [not null]
|
|
"image" varchar(255)
|
|
"small_image" varchar(255)
|
|
"mal_id" int
|
|
"mal_url" varchar(255)
|
|
"liked" int [not null, default: 0]
|
|
"connections" int [default: 0]
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."medias" {
|
|
"id" uuid [pk, not null, ref: > "public"."media_submissions"."media_id"]
|
|
"mal_id" int [not null]
|
|
"title" varchar(255) [not null]
|
|
"title_secondary" varchar(255)
|
|
"title_original" varchar(255)
|
|
"title_synonyms" varchar(255) [note: 'This is Array']
|
|
"trailers" uuid
|
|
"synopsis" text [not null]
|
|
"small_image_url" varchar(255)
|
|
"medium_image_url" varchar(255) [not null]
|
|
"large_image_url" varchar(255)
|
|
"type" uuid [not null, ref: > "public"."media_types"."id"]
|
|
"source" uuid [not null, ref: > "public"."media_sources"."id"]
|
|
"status" uuid [not null, ref: > "public"."media_statuses"."id"]
|
|
"airing" boolean [not null, default: false]
|
|
"start_airing" date
|
|
"end_airing" date
|
|
"age_rating" uuid [ref: > "public"."media_age_ratings"."id"]
|
|
"score" numeric(2,2) [not null, default: 0]
|
|
"score_total" int [not null, default: 0]
|
|
"scored_by" int [not null, default: 0]
|
|
"favourites" int [not null, default: 0]
|
|
"background" text
|
|
"season" varchar(15) [not null, note: 'enum(winter, spring, summer, fall)']
|
|
"year" smallint [not null]
|
|
"country" uuid [not null, ref: > "public"."countries"."id"]
|
|
"broadcast_date" varchar(64)
|
|
"producers" uuid [not null]
|
|
"licensors" uuid [not null]
|
|
"studios" uuid [not null]
|
|
"genres" uuid
|
|
"episodes" uuid
|
|
"explicit_genres" uuid
|
|
"themes" uuid
|
|
"demographics" uuid
|
|
"relations" uuid
|
|
"external_links" uuid
|
|
"characters" uuid
|
|
"approved" boolean [default: false]
|
|
"approved_by" uuid
|
|
"created_by" uuid [not null]
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."media_relations" {
|
|
"id" uuid [pk, not null, ref: > "public"."medias"."relations"]
|
|
"relation" varchar(16)
|
|
"target_media" uuid [ref: > "public"."medias"."id"]
|
|
}
|
|
|
|
Table "public"."media_sources" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(18) [not null]
|
|
}
|
|
|
|
Table "public"."videos" {
|
|
"id" uuid [pk, not null, ref: > "public"."episodes"."videos", ref: - "public"."video_submissions"."video_id"]
|
|
"service_id" uuid [not null, ref: > "public"."video_services"."id"]
|
|
"video_code" varchar(255) [not null]
|
|
"short_code" varchar(255)
|
|
"thumbnail_code" varchar(255)
|
|
"download_code" varchar(255)
|
|
"pending_upload" boolean [default: true]
|
|
"created_by" uuid [not null]
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."user_country_preferences" {
|
|
"user_id" uuid [not null, ref: > "public"."user_preferences"."user_id"]
|
|
"country_id" uuid [unique, not null, ref: > "public"."countries"."id"]
|
|
"state" user_preference_state [not null]
|
|
}
|
|
|
|
Table "public"."media_producers" {
|
|
"media_id" uuid [not null, ref: > "public"."medias"."producers"]
|
|
"producer_id" uuid [not null, ref: > "public"."producers"."id"]
|
|
|
|
Indexes {
|
|
(media_id, producer_id) [pk]
|
|
}
|
|
}
|
|
|
|
Table "public"."media_age_ratings" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(64) [not null]
|
|
"min_age" smallint [not null]
|
|
}
|
|
|
|
Table "public"."comment_audit_logs" {
|
|
"id" uuid [pk, not null]
|
|
"comment_id" uuid [not null, ref: > "public"."comments"."id"]
|
|
"performed_by" uuid [not null, ref: > "public"."users"."id"]
|
|
"action" audit_action [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."media_characters" {
|
|
"id" uuid [pk, not null, ref: > "public"."medias"."characters"]
|
|
"role" text [not null, note: 'main, supporting']
|
|
"characters" uuid [not null, ref: > "public"."characters"."id"]
|
|
"voice_actor" uuid [not null]
|
|
}
|
|
|
|
Table "public"."provisioned_users" {
|
|
"provisioned_by" uuid [unique, not null, ref: > "public"."users"."id"]
|
|
"provisioned_to" uuid [not null, ref: > "public"."users"."id"]
|
|
"provisioned_at" timestamp [not null]
|
|
"reason" bigint
|
|
}
|
|
|
|
Table "public"."collection_members" {
|
|
"id" uuid [pk, not null]
|
|
"collection_id" uuid [not null, ref: > "public"."collections"."id"]
|
|
"user_id" uuid [not null, ref: > "public"."users"."id"]
|
|
"access_level" collection_access_level [not null]
|
|
"invited_by" uuid [ref: > "public"."users"."id"]
|
|
"joined_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."countries" {
|
|
"id" uuid [pk, not null, ref: - "public"."users"."country"]
|
|
"name" varchar(155) [not null]
|
|
"slug" varchar(165) [unique, not null]
|
|
"code" varchar(3) [unique, not null]
|
|
"flag" varchar(255)
|
|
"banner" varchar(255)
|
|
}
|
|
|
|
Table "public"."media_explicit_genres" {
|
|
"media_id" uuid [not null, ref: > "public"."medias"."explicit_genres"]
|
|
"genre_id" uuid [not null, ref: > "public"."genres"."id"]
|
|
|
|
Indexes {
|
|
(media_id, genre_id) [pk]
|
|
}
|
|
|
|
Note: 'composite primary key = media_id + genre_id'
|
|
}
|
|
|
|
Table "public"."media_external_links" {
|
|
"id" uuid [pk, not null, ref: > "public"."medias"."external_links"]
|
|
"media_id" uuid [ref: > "public"."medias"."id"]
|
|
"name" varchar(64)
|
|
"url" varchar(255)
|
|
}
|
|
|
|
Table "public"."media_statuses" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(64) [unique, not null]
|
|
}
|
|
|
|
Table "public"."producers" {
|
|
"id" uuid [pk, not null]
|
|
"mal_id" int [not null]
|
|
"type" varchar(24) [not null]
|
|
"name" varchar(155) [not null]
|
|
"url" varchar(255)
|
|
"created_by" uuid [not null]
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."user_watch_histories" {
|
|
"user_id" uuid [not null, ref: > "public"."users"."id"]
|
|
"episode_id" uuid [not null, ref: > "public"."episodes"."id"]
|
|
"updated_at" timestamp [not null]
|
|
|
|
Indexes {
|
|
(episode_id, user_id) [unique, name: "index_1"]
|
|
}
|
|
}
|
|
|
|
Table "public"."user_preferences" {
|
|
"user_id" uuid [pk, not null]
|
|
"character_as_partner" uuid [ref: > "public"."characters"."id"]
|
|
"comment_picture" varchar(255)
|
|
"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]
|
|
}
|
|
|
|
Table "public"."user_genre_preferences" {
|
|
"user_id" uuid [unique, not null, ref: > "public"."user_preferences"."user_id"]
|
|
"genre_id" uuid [not null, ref: > "public"."genres"."id"]
|
|
"state" user_preference_state [not null]
|
|
|
|
Indexes {
|
|
(user_id, genre_id) [unique, name: "index_1_1"]
|
|
}
|
|
}
|
|
|
|
Table "public"."media_collections" {
|
|
"collection_id" uuid [unique, not null, ref: > "public"."collections"."id"]
|
|
"media_id" uuid [not null, ref: > "public"."medias"."id"]
|
|
"added_by" uuid [not null, ref: > "public"."users"."id"]
|
|
"added_at" bigint [not null]
|
|
|
|
Indexes {
|
|
(collection_id, media_id) [unique, name: "index_1_2"]
|
|
}
|
|
}
|
|
|
|
Table "public"."comments" {
|
|
"id" uuid [pk, not null]
|
|
"user_id" uuid [not null, ref: > "public"."users"."id"]
|
|
"episode_id" uuid [not null, ref: > "public"."episodes"."id"]
|
|
"content" varchar(255) [not null]
|
|
"created_at" timestamp [not null]
|
|
"updated_at" timestamp [not null]
|
|
"deleted_at" timestamp
|
|
}
|
|
|
|
Table "public"."user_oauth_credentials" {
|
|
"id" uuid [pk, not null, ref: > "public"."users"."id"]
|
|
"user_id" uuid [not null]
|
|
"oauth_id" uuid [not null]
|
|
"provider_token" varchar(500)
|
|
"provider_sub" varchar(500)
|
|
"last_action" timestamp [not null]
|
|
|
|
Indexes {
|
|
(oauth_id, user_id) [unique, name: "index_2"]
|
|
}
|
|
}
|
|
|
|
Table "public"."staff" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(255) [not null]
|
|
"image" varchar(255)
|
|
"mal_id" int
|
|
"mal_url" varchar(255)
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."home_media_banner" {
|
|
"id" uuid [pk, not null]
|
|
"media_id" uuid [not null, ref: > "public"."medias"."id"]
|
|
"created_by" uuid [not null, ref: > "public"."users"."id"]
|
|
"priority" smallint [unique]
|
|
"start_show" timestamp [not null]
|
|
"end_show" timestamp
|
|
"created_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."users" {
|
|
"id" uuid [pk, not null, ref: - "public"."user_preferences"."user_id", ref: - "public"."user_addresses"."user_id"]
|
|
"email" varchar(500) [unique, not null]
|
|
"password" varchar(255)
|
|
"username" varchar(28) [unique, not null]
|
|
"fullname" varchar(32) [not null]
|
|
"avatar" varchar(255)
|
|
"bio" text
|
|
"datebirth" date
|
|
"role" user_role [not null]
|
|
"sex" user_sex [not null]
|
|
"phone_number" varchar(15)
|
|
"country" uuid
|
|
"auth_provider" varchar(64)
|
|
"provider_token" varchar(255)
|
|
"created_at" timestamp [not null, default: `now()`]
|
|
"verified_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"deleted_at" timestamp
|
|
|
|
Indexes {
|
|
username [unique, name: "index_2_3"]
|
|
email [unique, name: "index_3"]
|
|
}
|
|
}
|
|
|
|
Table "public"."media_studios" {
|
|
"media_id" uuid [not null, ref: > "public"."medias"."studios"]
|
|
"producer_id" uuid [not null, ref: > "public"."producers"."id"]
|
|
|
|
Indexes {
|
|
(media_id, producer_id) [pk]
|
|
}
|
|
}
|
|
|
|
Table "public"."media_licencors" {
|
|
"media_id" uuid [not null, ref: > "public"."medias"."licensors"]
|
|
"producer_id" uuid [not null, ref: > "public"."producers"."id"]
|
|
|
|
Indexes {
|
|
(media_id, producer_id) [pk]
|
|
}
|
|
}
|
|
|
|
Table "public"."comment_reports" {
|
|
"id" uuid [unique, not null]
|
|
"reporter_id" uuid [not null, ref: > "public"."users"."id"]
|
|
"comment_id" uuid [not null, ref: > "public"."comments"."id"]
|
|
"title" varchar(115) [not null]
|
|
"status" status_submission [not null]
|
|
"description" text
|
|
"reported_at" timestamp [not null]
|
|
"closed_at" timestamp
|
|
}
|
|
|
|
Table "public"."genres" {
|
|
"id" uuid [pk, not null]
|
|
"mal_id" smallint
|
|
"type" varchar(16) [not null]
|
|
"name" varchar(32) [not null]
|
|
"url" varchar(155)
|
|
}
|
|
|
|
Table "public"."collections" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(64) [not null]
|
|
"cover_url" varchar(255) [not null]
|
|
"privacy_level" privacy_level [not null]
|
|
"created_at" timestamp [not null]
|
|
"updated_at" timestamp [not null]
|
|
}
|
|
|
|
Table "public"."voice_actors" {
|
|
"id" uuid [pk, not null, ref: > "public"."media_characters"."voice_actor"]
|
|
"language" varchar(115)
|
|
"actor_staff" uuid [ref: > "public"."staff"."id"]
|
|
}
|
|
|
|
Table "public"."video_submissions" {
|
|
"id" uuid [pk, not null]
|
|
"video_id" uuid [not null]
|
|
"created_by" uuid [not null, ref: > "public"."users"."id"]
|
|
"reviewed_by" uuid [ref: > "public"."users"."id"]
|
|
"status" status_submission [not null, default: 'pending']
|
|
"reviewed_at" timestamp
|
|
"reason" text
|
|
"created_at" timestamp [not null, default: `now()`]
|
|
}
|
|
|
|
Table "public"."media_genres" {
|
|
"media_id" uuid [unique, not null, ref: > "public"."medias"."genres"]
|
|
"genre_id" uuid [pk, not null, ref: > "public"."genres"."id"]
|
|
|
|
Indexes {
|
|
(media_id, genre_id) [unique, name: "index_1_4"]
|
|
}
|
|
|
|
Note: 'composite primary key = media_id + genre_id'
|
|
}
|
|
|
|
Table "public"."video_services" {
|
|
"id" uuid [pk, not null, ref: - "public"."video_service_submissions"."video_service_id"]
|
|
"name" varchar(155) [not null]
|
|
"resolution" smallint [not null]
|
|
"domain" varchar(255) [not null]
|
|
"image_url" varchar(255)
|
|
"hex_color" varchar(10)
|
|
"endpoint_video" varchar(255) [not null]
|
|
"endpoint_short" varchar(255)
|
|
"endpoint_image" varchar(255)
|
|
"endpoint_download" varchar(255)
|
|
"created_by" uuid [not null]
|
|
"deleted_at" timestamp
|
|
"updated_at" timestamp [not null]
|
|
"created_at" timestamp [not null]
|
|
|
|
Indexes {
|
|
(name, resolution) [unique, name: "idx_video_services_name_resolution"]
|
|
}
|
|
}
|
|
|
|
Table "public"."media_submissions" {
|
|
"id" uuid [pk, not null]
|
|
"media_id" uuid [not null]
|
|
"created_by" uuid [not null]
|
|
"status" status_submission [not null]
|
|
"reviewed_by" uuid
|
|
"reviewed_at" timestamp
|
|
"reason" text
|
|
"created_at" timestamp [not null, default: `now()`]
|
|
}
|
|
|
|
Table "public"."video_service_submissions" {
|
|
"id" uuid [pk, not null]
|
|
"video_service_id" uuid [not null]
|
|
"created_by" uuid [not null]
|
|
"status" status_submission [not null, default: 'pending']
|
|
"reviewed_by" uuid
|
|
"reviewed_at" timestamp
|
|
"reason" text
|
|
"created_at" timestamp [not null, default: `now()`]
|
|
}
|
|
|
|
Table "public"."media_trailers" {
|
|
"id" uuid [pk, not null, ref: - "public"."medias"."trailers"]
|
|
"url" varchar(255)
|
|
"embed_url" varchar(255)
|
|
"small_image_url" varchar(255)
|
|
"medium_image_url" varchar(255)
|
|
"large_image_url" varchar(255)
|
|
"maximum_image_url" varchar(255)
|
|
}
|
|
|
|
Table "public"."media_types" {
|
|
"id" uuid [pk, not null]
|
|
"name" varchar(18) [not null]
|
|
}
|
|
|
|
Table "public"."user_follows" {
|
|
"follower_id" uuid [unique, not null, ref: > "public"."users"."id"]
|
|
"following_id" uuid [not null, ref: > "public"."users"."id"]
|
|
"followed_at" timestamp [not null]
|
|
|
|
Indexes {
|
|
(following_id, follower_id) [unique, name: "index_1_5"]
|
|
}
|
|
|
|
checks {
|
|
`follower_id <> following_id`
|
|
}
|
|
}
|
|
|
|
Table "public"."media_themes" {
|
|
"media_id" uuid [not null, ref: > "public"."medias"."themes"]
|
|
"genre_id" uuid [not null, ref: > "public"."genres"."id"]
|
|
|
|
Indexes {
|
|
(media_id, genre_id) [pk]
|
|
}
|
|
}
|
|
|
|
Table "public"."comment_likes" {
|
|
"user_id" uuid [unique, not null, ref: > "public"."medias"."id"]
|
|
"comment_id" uuid [not null, ref: > "public"."comments"."id"]
|
|
"type" like_type [not null]
|
|
"created_at" timestamp [not null]
|
|
|
|
Indexes {
|
|
(comment_id, user_id) [unique, name: "index_1_6"]
|
|
}
|
|
}
|
|
|
|
Table "public"."user_sessions" {
|
|
"id" uuid [pk, not null]
|
|
"user_id" uuid [not null, ref: > "public"."users"."id"]
|
|
"device_type" device_type [not null]
|
|
"os_type" varchar(500)
|
|
"os_version" varchar(500)
|
|
"browser_name" varchar(500)
|
|
"browser_version" varchar(500)
|
|
"ip_login" inet [not null]
|
|
"last_activity_at" timestamp
|
|
"login_at" timestamp [not null]
|
|
"logout_at" timestamp
|
|
}
|
|
|
|
Table "public"."user_addresses" {
|
|
"user_id" uuid [pk, not null]
|
|
"street_address" varchar(500) [not null]
|
|
"district" varchar(500) [not null]
|
|
"city" varchar(500) [not null]
|
|
"province" varchar(500) [not null]
|
|
"postal_code" varchar(500) [not null]
|
|
"coordinate" varchar(500)
|
|
"updated_at" timestamp [not null]
|
|
}
|