diff --git a/prisma/dbml/schema.dbml b/prisma/dbml/schema.dbml index 9abb82f..0d70e09 100644 --- a/prisma/dbml/schema.dbml +++ b/prisma/dbml/schema.dbml @@ -1,808 +1,580 @@ -//// ------------------------------------------------------ -//// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) -//// ------------------------------------------------------ - -Table medias { - id String [pk] - title String [not null] - titleAlternative Json [not null] - slug String [unique, not null] - malId Int [unique] - pictureMedium String [not null] - pictureLarge String [not null] - genres genres [not null] - country Country [not null, default: 'JP'] - score Decimal [not null, default: 0] - status String [not null] - startAiring DateTime - endAiring DateTime - synopsis String [not null] - ageRating String [not null] - mediaType MediaType [not null] - source String - studios studios [not null] - characters characters [not null] - onDraft Boolean [not null, default: true] - uploader users [not null] - uploadedBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - bannerPromotion hero_banner [not null] - logs media_logs [not null] - episodes episodes [not null] - reviews movie_reviews [not null] - inCollections CollectionMedia [not null] +Enum "audit_action" { + "delete" + "restore" + "edit" + "flag" } -Table media_logs { - id String [pk] - status MediaOperation [not null] - approval Boolean [not null, default: false] - proposer users [not null] - proposedBy String [not null] - approver users [not null] - approvedBy String [not null] - media medias [not null] - mediaId String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +Enum "collection_access_level" { + "viewer" + "contributor" + "moderator" + "owner" } -Table genres { - id String [pk] - name String [not null] - slug String [unique, not null] - malId Int [unique, not null] - malUrl String [not null] - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - medias medias [not null] - user_favourite_genres user_preferences [not null] +Enum "privacy_level" { + "private" + "unlisted" + "public" } -Table studios { - id String [pk] - name String [not null] - slug String [unique, not null] - linkAbout String [not null] - malId Int [unique, not null] - logoUrl String - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - medias medias [not null] +Enum "status_submission" { + "pending" + "approved" + "rejected" } -Table characters { - id String [pk] - malId Int [unique, not null] - name String [not null] - role CharacterRole [not null] - favorites Int [not null, default: 0] - imageUrl String - smallImageUrl String - createdBy users [not null] - creatorId String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - medias medias [not null] - voice_actors lang_va_char [not null] +Enum "user_preference_state" { + "exclude" + "include" } -Table voice_actors { - id String [pk] - malId Int [unique, not null] - name String [not null] - birthday DateTime - description String - aboutUrl String - imageUrl String - websiteUrl String - createdBy users [not null] - creatorId String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - characters lang_va_char [not null] +Enum "user_role" { + "user" + "contributor" + "curator" + "administrator" } -Table lang_va_char { - id String [pk] - language String [not null] - voiceActor voice_actors [not null] - vaId String [not null] - character characters [not null] - charId String [not null] - createdBy users [not null] - creatorId String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +Enum "user_sex" { + "female" + "male" +} - indexes { - (language, vaId, charId) [unique] +Enum "like_type" { + "like" + "dislike" +} + +Enum "device_type" { + "mobile" + "tablet" + "desktop" + "unknown" +} + +Enum "oauth_provider" { + "google" + "github" +} + +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)[] + "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 episodes { - id String [pk] - media medias [not null] - mediaId String [not null] - episode Int [not null] - name String [not null] - score Decimal [not null, default: 0] - pictureThumbnail String - viewed BigInt [not null, default: 0] - likes BigInt [not null, default: 0] - dislikes BigInt [not null, default: 0] - pendingUpload Boolean [not null, default: true] - uploader users [not null] - uploadedBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - user_likes episode_likes [not null] - videos videos [not null] - user_histories watch_histories [not null] - comments comments [not null] +Table "public"."media_age_ratings" { + "id" uuid [pk, not null] + "name" varchar(64) [not null] + "min_age" smallint [not null] +} - indexes { - (mediaId, episode) [unique] +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" varchar(255) +} + +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 episode_likes { - id String [pk] - user users [not null] - userId String [not null] - session user_sessions [not null] - sessionId String [not null] - episode episodes [not null] - episodeId String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 videos { - id String [pk] - episode episodes [not null] - episodeId String [not null] - service video_services [not null] - serviceId String [not null] - videoCode String [not null] - thumbnailCode String - pendingUpload Boolean [not null, default: true] - uploader users [not null] - uploadedBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 { - (serviceId, videoCode) [unique] + Indexes { + (user_id, genre_id) [unique, name: "index_1_1"] } } -Table video_services { - id String [pk] - name String [unique, not null] - domain String [not null] - logo String - hexColor String [not null] - endpointVideo String [not null] - endpointThumbnail String - endpointDownload String - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - videos videos [not null] - user_preferences user_preferences [not null] -} +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] -Table users { - id String [pk] - name String [not null] - username String [unique, not null] - email String [unique, not null] - password String [not null] - birthDate DateTime - gender UserGender - phoneCC Int - phoneNumber Int - assignedRoles user_role_assignments [not null] - bioProfile String - avatar String - commentBackground String - provider String - providerId String [unique] - providerToken String - providerPayload Json - preference user_preferences - verifiedAt DateTime - disabledAt DateTime - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - medias medias [not null] - media_proposeds media_logs [not null] - media_approveds media_logs [not null] - genres genres [not null] - studios studios [not null] - characters characters [not null] - voice_actor voice_actors [not null] - lang_va_char lang_va_char [not null] - episodes episodes [not null] - episode_likes episode_likes [not null] - videos videos [not null] - video_services video_services [not null] - create_roles user_roles [not null] - notifications user_notifications [not null] - sessions user_sessions [not null] - logs user_logs [not null] - collections collections [not null] - allowed_collections collections [not null] - watch_histories watch_histories [not null] - media_reviews movie_reviews [not null] - comments comments [not null] - liked_comments comment_likes [not null] - reported_comments comment_reports [not null] - approved_comments comment_reports [not null] - create_languages languages [not null] - user_create_email email_system_accounts [not null] - user_emails email_system_histories [not null] - user_hero_banner hero_banner [not null] - sys_notifications system_notifications [not null] - sys_logs system_logs [not null] -} - -Table user_preferences { - id String [pk] - user users [not null] - userId String [unique, not null] - lang languages - langPreference String - adultFiltering AdultFiltering [not null, default: 'hide'] - adultAlert AdultAlert [not null, default: 'show'] - videoQuality VideoQuality [not null, default: 'Q1080'] - serviceDefault video_services - serviceDefaultId String - hideContries Country[] [not null] - favoriteGenres genres [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] -} - -Table user_roles { - id String [pk] - name String [unique, not null] - description String - primaryColor String - secondaryColor String - pictureImage String - badgeImage String - isSuperadmin Boolean [not null, default: false] - canEditMedia Boolean [not null, default: false] - canManageMedia Boolean [not null, default: false] - canEditEpisodes Boolean [not null, default: false] - canManageEpisodes Boolean [not null, default: false] - canEditComment Boolean [not null, default: false] - canManageComment Boolean [not null, default: false] - canEditUser Boolean [not null, default: false] - canManageUser Boolean [not null, default: false] - canEditSystem Boolean [not null, default: false] - canManageSystem Boolean [not null, default: false] - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - assignedUser user_role_assignments [not null] -} - -Table user_role_assignments { - user users [not null] - userId String [not null] - role user_roles [not null] - roleId String [not null] - assignmentAt DateTime [default: `now()`, not null] - - indexes { - (userId, roleId) [pk] + Indexes { + (collection_id, media_id) [unique, name: "index_1_2"] } } -Table user_notifications { - id String [pk] - title String [not null] - content String [not null] - picture String [not null] - state UserNotificationState [not null] - ctaLink String [not null] - user users [not null] - userId String [not null] - isReaded Boolean [not null, default: false] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 user_sessions { - id String [pk] - isAuthenticated Boolean [not null, default: false] - user users [not null] - userId String [not null] - deviceType String [not null] - deviceOs String [not null] - deviceIp String [not null] - browser String [not null] - isOnline Boolean [not null, default: false] - lastOnline DateTime [default: `now()`, not null] - validUntil DateTime [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - logs user_logs [not null] - episode_likes episode_likes [not null] - watch_histories watch_histories [not null] -} +Table "public"."user_oauth_accounts" { + "id" uuid [pk, not null] + "user_id" uuid [not null, ref: > "public"."users"."id"] + "provider_name" oauth_provider [not null] + "provider_sub" varchar(255) + "provider_email" varchar(255) + "access_token" varchar(255) + "refresh_token" varchar(255) + "last_login" timestamptz [not null] + "expires_at" timestamptz + "created_at" timestamptz [not null] + "updated_at" timestamptz [not null] -Table user_logs { - id String [pk] - title String [not null] - notes String [not null] - user users [not null] - userId String [not null] - session user_sessions [not null] - sessionId String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] -} - -Table collections { - id String [pk] - name String [not null] - slug String [not null] - owner users [not null] - ownerId String [not null] - accessStatus AccessStatus [not null, default: 'private'] - password String - usersAllowed users [not null] - accessScope AccessScope [not null, default: 'viewer'] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - media_saved CollectionMedia [not null] - - indexes { - (slug, ownerId) [unique] + Indexes { + (user_id, provider_name) [unique, name: "index_2"] } } -Table CollectionMedia { - id String [pk] - collection collections [not null] - collectionId String [not null] - media medias [not null] - mediaId String [not null] - savedAt DateTime [default: `now()`, not null] +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] +} - indexes { - (collectionId, mediaId) [unique] +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 watch_histories { - id String [pk] - episode episodes [not null] - episodeId String [not null] - user users [not null] - userId String [not null] - session user_sessions [not null] - sessionId String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 movie_reviews { - id String [pk] - media medias [not null] - mediaId String [not null] - rating Int [not null] - title String [not null] - text String [not null] - reaction MediaReviewReaction [not null] - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 comments { - id String [pk] - episode episodes [not null] - episodeId String [not null] - text String [not null] - isParent Boolean [not null, default: false] - parent comments - parentId String - user users [not null] - userId String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - replies comments [not null] - likes comment_likes [not null] +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 comment_likes { - id String [pk] - comment comments [not null] - commentId String [not null] - user users [not null] - userLiked String [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 comment_reports { - id String [pk] - reporter users [not null] - userReporter String [not null] - commentReported String [not null] - isSupervisorReport Boolean [not null, default: false] - reason ReportReason [not null] - status ReportStatus [not null] - description String [not null] - approver users - approvedBy String - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 languages { - id String [pk] - name String [not null] - code String [unique, not null] - countryFlag String [not null] - fileLocation String [not null] - creator users [not null] - craetedBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - user_used user_preferences [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 email_system_accounts { - id String [pk] - name String [unique, not null] - host String [not null] - port Int [not null] - secure Boolean [not null] - email String [unique, not null] - username String [unique, not null] - password String [not null] - purpose EmailPorpose [not null] - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 email_system_histories { - id String [pk] - purpose EmailPorpose [not null] - fromEmail String [not null] - toEmail String [not null] - user users [not null] - userRelated String [not null] - title String [not null] - htmlContent String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 hero_banner { - id String [pk] - orderPriority Int [unique] - mediaId String [not null] - media medias [not null] - imageUrl String - startDate DateTime [not null] - endDate DateTime [not null] - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] - creatorId String [not null] - createdBy users [not null] +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 system_preferences { - id String [pk] - key String [unique, not null] - value String [not null] - description String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 system_notifications { - id String [pk] - type TypeSystemNotification [not null] - componentName String - popupImage String - titleToast String - contentToast String - creator users [not null] - createdBy String [not null] - deletedAt DateTime - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 system_logs { - id String [pk] - title String [not null] - notes String [not null] - user users - relatedUser String - createdAt DateTime [default: `now()`, not null] - updatedAt DateTime [default: `now()`, not null] +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 MediaGenres { - genresId String [ref: > genres.id] - mediasId String [ref: > medias.id] +Table "public"."media_types" { + "id" uuid [pk, not null] + "name" varchar(18) [not null] } -Table MediaStudios { - studiosId String [ref: > studios.id] - mediasId String [ref: > medias.id] +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 MediaCharacters { - charactersId String [ref: > characters.id] - mediasId String [ref: > medias.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 CollectionMedia { - incollectionsId String [ref: > CollectionMedia.id] - media_savedId String [ref: > CollectionMedia.id] +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 UserFavoriteGenres { - user_favourite_genresId String [ref: > user_preferences.id] - favoritegenresId String [ref: > genres.id] +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(50) + "os_version" varchar(50) + "browser_name" varchar(50) + "browser_version" varchar(50) + "ip_login" inet [not null] + "login_at" timestamptz [not null] + "logout_at" timestamptz } -Table UserSelectedSharingCollention { - allowed_collectionsId String [ref: > collections.id] - usersallowedId String [ref: > users.id] +Table "public"."user_addresses" { + "user_id" uuid [pk, not null] + "street_address" varchar(255) [not null] + "district" varchar(100) [not null] + "city" varchar(100) [not null] + "province" varchar(100) [not null] + "postal_code" varchar(20) [not null] + "coordinate" varchar(50) + "updated_at" timestamp [not null] } - -Enum MediaType { - TV - ONA - OVA - Movie - Special - Music -} - -Enum Country { - JP - EN - ID - KR -} - -Enum CharacterRole { - Main - Supporting -} - -Enum MediaOperation { - create - update - delete -} - -Enum UserGender { - male - female -} - -Enum AdultFiltering { - hide - show - explicit -} - -Enum AdultAlert { - hide - show -} - -Enum VideoQuality { - Q2160 - Q1440 - Q1080 - Q720 - Q480 - Q360 - Q240 - Q144 -} - -Enum UserNotificationState { - info - warning - danger -} - -Enum ReportStatus { - pending - resolved - rejected -} - -Enum ReportReason { - sexualize - violent - explicit - hateful - political - racist - spam - other -} - -Enum AccessStatus { - private - selected - protected - public -} - -Enum AccessScope { - viewer - editor -} - -Enum MediaReviewReaction { - angry - sad - awesome - happy - sleepy - annoyed - disgusting - disappointed -} - -Enum EmailPorpose { - forgot_password - account_activation - account_notification - subscribtion -} - -Enum TypeSystemNotification { - component - popup - toast -} - -Ref: medias.uploadedBy > users.id - -Ref: media_logs.proposedBy > users.id - -Ref: media_logs.approvedBy > users.id - -Ref: media_logs.mediaId > medias.id - -Ref: genres.createdBy > users.id - -Ref: studios.createdBy > users.id - -Ref: characters.creatorId > users.id - -Ref: voice_actors.creatorId > users.id - -Ref: lang_va_char.vaId > voice_actors.id - -Ref: lang_va_char.charId > characters.id - -Ref: lang_va_char.creatorId > users.id - -Ref: episodes.mediaId > medias.id - -Ref: episodes.uploadedBy > users.id - -Ref: episode_likes.userId > users.id - -Ref: episode_likes.sessionId > user_sessions.id - -Ref: episode_likes.episodeId > episodes.id - -Ref: videos.episodeId > episodes.id - -Ref: videos.serviceId > video_services.id - -Ref: videos.uploadedBy > users.id - -Ref: video_services.createdBy > users.id - -Ref: user_preferences.userId - users.id - -Ref: user_preferences.langPreference > languages.code - -Ref: user_preferences.serviceDefaultId > video_services.id - -Ref: user_roles.createdBy > users.id - -Ref: user_role_assignments.userId > users.id - -Ref: user_role_assignments.roleId > user_roles.id - -Ref: user_notifications.userId > users.id - -Ref: user_sessions.userId > users.id - -Ref: user_logs.userId > users.id - -Ref: user_logs.sessionId > user_sessions.id - -Ref: collections.ownerId > users.id - -Ref: CollectionMedia.collectionId > collections.id - -Ref: CollectionMedia.mediaId > medias.id - -Ref: watch_histories.id > episodes.id - -Ref: watch_histories.userId > users.id - -Ref: watch_histories.sessionId > user_sessions.id - -Ref: movie_reviews.mediaId > medias.id - -Ref: movie_reviews.createdBy > users.id - -Ref: comments.episodeId > episodes.id - -Ref: comments.parentId - comments.id - -Ref: comments.userId > users.id - -Ref: comment_likes.commentId > comments.id - -Ref: comment_likes.userLiked > users.id - -Ref: comment_reports.userReporter > users.id - -Ref: comment_reports.approvedBy > users.id - -Ref: languages.craetedBy > users.id - -Ref: email_system_accounts.createdBy > users.id - -Ref: email_system_histories.userRelated > users.id - -Ref: hero_banner.mediaId > medias.id - -Ref: hero_banner.creatorId > users.id - -Ref: system_notifications.createdBy > users.id - -Ref: system_logs.relatedUser > users.id \ No newline at end of file diff --git a/prisma/diagram.json b/prisma/diagram.json new file mode 100644 index 0000000..b6c7bf1 --- /dev/null +++ b/prisma/diagram.json @@ -0,0 +1,6413 @@ +{ + "id": "0", + "name": "Main Diagram", + "createdAt": "2026-05-19T16:28:02.086Z", + "updatedAt": "2026-05-22T00:43:03.985Z", + "databaseType": "postgresql", + "tables": [ + { + "id": "1", + "name": "media_demographics", + "x": -681.6737980968087, + "y": 892.2019045876625, + "fields": [ + { + "id": "2", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "unique": true, + "nullable": false, + "primaryKey": true, + "createdAt": 1779210978216 + }, + { + "id": "3", + "name": "genre_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "unique": true, + "nullable": false, + "primaryKey": true, + "createdAt": 1779211013182 + } + ], + "indexes": [ + { + "id": "4", + "name": "", + "fieldIds": [ + "2", + "3" + ], + "unique": true, + "isPrimaryKey": true, + "createdAt": 1779211084967 + } + ], + "color": "#ffe374", + "createdAt": 1779210978216, + "isView": false, + "order": 46, + "schema": "public", + "diagramId": "3taaalng0ut0" + }, + { + "id": "5", + "name": "characters", + "schema": "public", + "x": -1033.0409991807485, + "y": 748.9601716847773, + "fields": [ + { + "id": "6", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "7", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "8", + "name": "image", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "9", + "name": "small_image", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "10", + "name": "mal_id", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "11", + "name": "liked", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "default": "0" + }, + { + "id": "12", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "13", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "14", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + } + ], + "indexes": [ + { + "id": "15", + "name": "", + "unique": true, + "fieldIds": [ + "6" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589093, + "order": 10, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "16", + "name": "media_genres", + "schema": "public", + "x": -680.2926238134676, + "y": 498.7845736528544, + "fields": [ + { + "id": "17", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1777283473368 + }, + { + "id": "18", + "name": "genre_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777283550230 + } + ], + "indexes": [ + { + "id": "19", + "name": "", + "unique": true, + "fieldIds": [ + "18" + ], + "createdAt": 1777283473368, + "isPrimaryKey": true + }, + { + "id": "20", + "name": "index_1", + "unique": true, + "fieldIds": [ + "17", + "18" + ], + "createdAt": 1778570545534 + } + ], + "checkConstraints": [], + "color": "#ffe374", + "isView": false, + "createdAt": 1777283473368, + "comments": "composite primary key = media_id + genre_id ", + "order": 18, + "diagramId": "3taaalng0ut0" + }, + { + "id": "21", + "name": "countries", + "schema": "public", + "x": -675.4825871206289, + "y": -936.5527418709639, + "fields": [ + { + "id": "22", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778401101216 + }, + { + "id": "23", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778401175441, + "characterMaximumLength": "155" + }, + { + "id": "24", + "name": "slug", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778401182473, + "characterMaximumLength": "165" + }, + { + "id": "25", + "name": "code", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778401186425, + "characterMaximumLength": "3" + }, + { + "id": "26", + "name": "flag", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778401191401, + "characterMaximumLength": "255" + }, + { + "id": "27", + "name": "banner", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778401286123, + "characterMaximumLength": "255" + } + ], + "indexes": [ + { + "id": "28", + "name": "", + "unique": true, + "fieldIds": [ + "22" + ], + "createdAt": 1778401101216, + "isPrimaryKey": true + } + ], + "color": "#b067e9", + "isView": false, + "createdAt": 1778401101216, + "order": 27, + "diagramId": "3taaalng0ut0" + }, + { + "id": "29", + "name": "user_country_preferences", + "schema": "public", + "x": -1035.3700148414782, + "y": -1151.086340953631, + "fields": [ + { + "id": "30", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548950226 + }, + { + "id": "31", + "name": "country_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778548914423 + }, + { + "id": "32", + "name": "state", + "type": { + "id": "user_preference_state", + "name": "user_preference_state" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548957483 + } + ], + "indexes": [], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778548914423, + "order": 33, + "diagramId": "3taaalng0ut0" + }, + { + "id": "33", + "name": "media_characters", + "schema": "public", + "x": -678.5745105809615, + "y": 1034.4123102253634, + "fields": [ + { + "id": "34", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "unique": true, + "nullable": false, + "primaryKey": true, + "createdAt": 1779379905921 + }, + { + "id": "35", + "name": "media", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "36", + "name": "character", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "37", + "name": "role", + "type": { + "id": "enum", + "name": "enum" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "comments": "main, supporting" + }, + { + "id": "38", + "name": "voice_actor", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + } + ], + "indexes": [ + { + "id": "39", + "name": "", + "unique": true, + "fieldIds": [ + "34", + "36" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 8, + "diagramId": "3taaalng0ut0" + }, + { + "id": "40", + "name": "media_submissions", + "schema": "public", + "x": -677.2819917810897, + "y": -656.6674640748546, + "fields": [ + { + "id": "41", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777362610195 + }, + { + "id": "42", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362624424 + }, + { + "id": "43", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362635996, + "comments": "" + }, + { + "id": "44", + "name": "status", + "type": { + "id": "status_submission", + "name": "status_submission" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362700148, + "comments": "" + }, + { + "id": "45", + "name": "reviewed_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777362758238 + }, + { + "id": "46", + "name": "reviewed_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777363627973 + }, + { + "id": "47", + "name": "reason", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777363674757 + }, + { + "id": "48", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777363686543, + "default": "now()" + } + ], + "indexes": [ + { + "id": "49", + "name": "", + "unique": true, + "fieldIds": [ + "41" + ], + "createdAt": 1777362610195, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777362610195, + "order": 24, + "diagramId": "3taaalng0ut0" + }, + { + "id": "50", + "name": "home_media_banner", + "schema": "public", + "x": -1034.714934672103, + "y": -969.0938770634809, + "fields": [ + { + "id": "51", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778771594518 + }, + { + "id": "52", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778771625245 + }, + { + "id": "53", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778771632111 + }, + { + "id": "54", + "name": "priority", + "type": { + "id": "smallint", + "name": "smallint" + }, + "primaryKey": false, + "unique": true, + "nullable": true, + "createdAt": 1778771638786 + }, + { + "id": "55", + "name": "start_show", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778771679920 + }, + { + "id": "56", + "name": "end_show", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778771687135 + }, + { + "id": "57", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778771693471 + } + ], + "indexes": [ + { + "id": "58", + "name": "", + "unique": true, + "fieldIds": [ + "51" + ], + "createdAt": 1778771594518, + "isPrimaryKey": true + } + ], + "color": "#b067e9", + "isView": false, + "createdAt": 1778771594518, + "order": 39, + "diagramId": "3taaalng0ut0" + }, + { + "id": "59", + "name": "media_external_links", + "schema": "public", + "x": 194.5066892978357, + "y": -264.72537027522213, + "fields": [ + { + "id": "60", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "61", + "name": "media", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "62", + "name": "site_name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "64" + }, + { + "id": "63", + "name": "url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + } + ], + "indexes": [ + { + "id": "64", + "name": "", + "unique": true, + "fieldIds": [ + "60" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 3, + "diagramId": "3taaalng0ut0" + }, + { + "id": "65", + "name": "user_addresses", + "schema": "public", + "x": 655.2842034425264, + "y": -1010.0698801871714, + "fields": [ + { + "id": "66", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778816506150 + }, + { + "id": "67", + "name": "street_address", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778816542685, + "characterMaximumLength": "255" + }, + { + "id": "68", + "name": "district", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778816551994, + "characterMaximumLength": "100" + }, + { + "id": "69", + "name": "city", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778816560720, + "characterMaximumLength": "100" + }, + { + "id": "70", + "name": "province", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778816564935, + "characterMaximumLength": "100" + }, + { + "id": "71", + "name": "postal_code", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778816568904, + "characterMaximumLength": "20" + }, + { + "id": "72", + "name": "coordinate", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778816577336, + "characterMaximumLength": "50" + }, + { + "id": "73", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778816585545 + } + ], + "indexes": [ + { + "id": "74", + "name": "", + "unique": true, + "fieldIds": [ + "66" + ], + "createdAt": 1778816506150, + "isPrimaryKey": true + } + ], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778816506150, + "order": 45, + "diagramId": "3taaalng0ut0" + }, + { + "id": "75", + "name": "media_themes", + "schema": "public", + "x": -681.5109900103016, + "y": 752.8680228454149, + "fields": [ + { + "id": "76", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777295294621 + }, + { + "id": "77", + "name": "genre_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777295323224 + } + ], + "indexes": [ + { + "id": "78", + "name": "", + "unique": true, + "fieldIds": [ + "76", + "77" + ], + "createdAt": 1777295294621, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777295294621, + "width": 224, + "order": 20, + "diagramId": "3taaalng0ut0" + }, + { + "id": "79", + "name": "medias", + "schema": "public", + "x": -338.2943640690703, + "y": -279.84862879126985, + "fields": [ + { + "id": "80", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "81", + "name": "mal_id", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "82", + "name": "title", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "83", + "name": "title_secondary", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "84", + "name": "title_original", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "85", + "name": "title_synonyms", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "isArray": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255", + "comments": "" + }, + { + "id": "86", + "name": "trailers", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "87", + "name": "synopsis", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "88", + "name": "small_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "89", + "name": "medium_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "90", + "name": "large_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "91", + "name": "type", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "92", + "name": "source", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "93", + "name": "status", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "94", + "name": "airing", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "default": "false" + }, + { + "id": "95", + "name": "start_airing", + "type": { + "id": "date", + "name": "date" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "96", + "name": "end_airing", + "type": { + "id": "date", + "name": "date" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "97", + "name": "age_rating", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "98", + "name": "score_total", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "default": "0" + }, + { + "id": "99", + "name": "score_count", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "default": "0" + }, + { + "id": "100", + "name": "background", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "101", + "name": "season", + "type": { + "id": "media_season", + "name": "media_season" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "comments": "enum(winter, spring, summer, fall)" + }, + { + "id": "102", + "name": "year", + "type": { + "id": "smallint", + "name": "smallint" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "103", + "name": "country", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777635858846 + }, + { + "id": "104", + "name": "broadcast_date", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "64" + }, + { + "id": "105", + "name": "producers", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "106", + "name": "licensors", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "107", + "name": "studios", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "108", + "name": "genres", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "109", + "name": "explicit_genres", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "110", + "name": "themes", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "111", + "name": "demographics", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "112", + "name": "relations", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "113", + "name": "external_links", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "114", + "name": "characters", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + }, + { + "id": "115", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "116", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "117", + "name": "updated_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "unique": false, + "nullable": true, + "primaryKey": false, + "createdAt": 1779410426323 + }, + { + "id": "118", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "119", + "name": "deleted_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "unique": false, + "nullable": true, + "primaryKey": false, + "createdAt": 1779410375341 + }, + { + "id": "120", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092 + } + ], + "indexes": [ + { + "id": "121", + "name": "", + "unique": true, + "fieldIds": [ + "80" + ], + "createdAt": 1777282589092, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589092, + "width": 337, + "order": 0, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "122", + "name": "media_studios", + "schema": "public", + "x": 194.57420294478976, + "y": 402.07246285824783, + "fields": [ + { + "id": "123", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777360514222 + }, + { + "id": "124", + "name": "producer_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777360544975 + } + ], + "indexes": [ + { + "id": "125", + "name": "", + "unique": true, + "fieldIds": [ + "123", + "124" + ], + "createdAt": 1777360514222, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777360514222, + "order": 23, + "diagramId": "3taaalng0ut0" + }, + { + "id": "126", + "name": "comments", + "schema": "public", + "x": -1035.4972528190797, + "y": -21.831519473281823, + "fields": [ + { + "id": "127", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778772484798 + }, + { + "id": "128", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772536237 + }, + { + "id": "129", + "name": "episode_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772542751 + }, + { + "id": "130", + "name": "content", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772548786, + "characterMaximumLength": "255" + }, + { + "id": "131", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777149915 + }, + { + "id": "132", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777198204 + }, + { + "id": "133", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778777213469 + } + ], + "indexes": [ + { + "id": "134", + "name": "", + "unique": true, + "fieldIds": [ + "127" + ], + "createdAt": 1778772484798, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1778772484798, + "order": 41, + "diagramId": "3taaalng0ut0" + }, + { + "id": "135", + "name": "staff", + "schema": "public", + "x": -1434.8828256841582, + "y": 424.7769062913411, + "fields": [ + { + "id": "136", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "137", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "138", + "name": "image", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "139", + "name": "mal_id", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "140", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "141", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "142", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + } + ], + "indexes": [ + { + "id": "143", + "name": "", + "unique": true, + "fieldIds": [ + "136" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589093, + "order": 12, + "diagramId": "3taaalng0ut0" + }, + { + "id": "144", + "name": "user_rating_preferences", + "schema": "public", + "x": -1036.138591583759, + "y": -1328.817114710954, + "fields": [ + { + "id": "145", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778548671790 + }, + { + "id": "146", + "name": "rating_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548699069 + }, + { + "id": "147", + "name": "state", + "type": { + "id": "user_preference_state", + "name": "user_preference_state" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548704423 + } + ], + "indexes": [], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778548671790, + "order": 32, + "diagramId": "3taaalng0ut0" + }, + { + "id": "148", + "name": "media_types", + "schema": "public", + "x": -678.8247906473255, + "y": -28.0163584990978, + "fields": [ + { + "id": "149", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "150", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "18" + } + ], + "indexes": [ + { + "id": "151", + "name": "", + "unique": true, + "fieldIds": [ + "149" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 4, + "diagramId": "3taaalng0ut0" + }, + { + "id": "152", + "name": "user_watch_histories", + "schema": "public", + "x": -335.9290422316319, + "y": -1189.7301850410581, + "fields": [ + { + "id": "153", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778569467263 + }, + { + "id": "154", + "name": "episode_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778569477336 + }, + { + "id": "155", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778569489813 + } + ], + "indexes": [ + { + "id": "156", + "name": "index_1", + "unique": true, + "fieldIds": [ + "154", + "153" + ], + "createdAt": 1778732177200 + } + ], + "color": "#9ef07a", + "isView": false, + "createdAt": 1778569427313, + "width": 337, + "order": 34, + "diagramId": "3taaalng0ut0" + }, + { + "id": "157", + "name": "users", + "schema": "public", + "x": -333.07222985751173, + "y": -1009.2656254027879, + "fields": [ + { + "id": "158", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778390635628 + }, + { + "id": "159", + "name": "email", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778391266880 + }, + { + "id": "160", + "name": "password", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778391484055, + "characterMaximumLength": "255" + }, + { + "id": "161", + "name": "username", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778390646288, + "characterMaximumLength": "28" + }, + { + "id": "162", + "name": "fullname", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778390830584, + "characterMaximumLength": "32" + }, + { + "id": "163", + "name": "avatar", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778390861984, + "characterMaximumLength": "255" + }, + { + "id": "164", + "name": "bio", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778390888222 + }, + { + "id": "165", + "name": "datebirth", + "type": { + "id": "date", + "name": "date" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778391007890 + }, + { + "id": "166", + "name": "role", + "type": { + "id": "user_role", + "name": "user_role" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778771211530 + }, + { + "id": "167", + "name": "sex", + "type": { + "id": "user_sex", + "name": "user_sex" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778391031530 + }, + { + "id": "168", + "name": "phone_number", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778391449319, + "characterMaximumLength": "15" + }, + { + "id": "169", + "name": "country", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778401621258 + }, + { + "id": "170", + "name": "auth_provider", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778515919288, + "characterMaximumLength": "64" + }, + { + "id": "171", + "name": "provider_token", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778515934284, + "characterMaximumLength": "255" + }, + { + "id": "172", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778517117468, + "default": "now()" + }, + { + "id": "173", + "name": "verified_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778815129265 + }, + { + "id": "174", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778517127447 + }, + { + "id": "175", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778517147463 + } + ], + "indexes": [ + { + "id": "176", + "name": "", + "unique": true, + "fieldIds": [ + "158" + ], + "createdAt": 1778390635628, + "isPrimaryKey": true + }, + { + "id": "177", + "name": "index_2", + "unique": true, + "fieldIds": [ + "161" + ], + "createdAt": 1778401234711 + }, + { + "id": "178", + "name": "index_3", + "unique": true, + "fieldIds": [ + "159" + ], + "createdAt": 1778401248519 + } + ], + "checkConstraints": [], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778390635628, + "width": 337, + "order": 26, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "179", + "name": "video_submissions", + "schema": "public", + "x": 1034.3413138628948, + "y": 376.2391754093071, + "fields": [ + { + "id": "180", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777362610195 + }, + { + "id": "181", + "name": "video_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362624424 + }, + { + "id": "182", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362635996, + "comments": "" + }, + { + "id": "183", + "name": "reviewed_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777362758238 + }, + { + "id": "184", + "name": "status", + "type": { + "id": "status_submission", + "name": "status_submission" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362700148, + "default": "pending", + "comments": "" + }, + { + "id": "185", + "name": "reviewed_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777363627973 + }, + { + "id": "186", + "name": "reason", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777363674757 + }, + { + "id": "187", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777363686543, + "default": "now()" + } + ], + "indexes": [ + { + "id": "188", + "name": "", + "unique": true, + "fieldIds": [ + "180" + ], + "createdAt": 1777362610195, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777362610195, + "width": 337, + "order": 24, + "diagramId": "3taaalng0ut0" + }, + { + "id": "189", + "name": "media_age_ratings", + "schema": "public", + "x": -679.7484316247582, + "y": 342.88283833657397, + "fields": [ + { + "id": "190", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "191", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "64" + }, + { + "id": "192", + "name": "min_age", + "type": { + "id": "smallint", + "name": "smallint" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + } + ], + "indexes": [ + { + "id": "193", + "name": "", + "unique": true, + "fieldIds": [ + "190" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 7, + "diagramId": "3taaalng0ut0" + }, + { + "id": "194", + "name": "media_trailers", + "schema": "public", + "x": -679.0151464808563, + "y": -319.10973511128714, + "fields": [ + { + "id": "195", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "196", + "name": "url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "197", + "name": "embed_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "198", + "name": "small_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "199", + "name": "medium_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589092, + "characterMaximumLength": "255" + }, + { + "id": "200", + "name": "large_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "201", + "name": "maximum_image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + } + ], + "indexes": [ + { + "id": "202", + "name": "", + "unique": true, + "fieldIds": [ + "195" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 2, + "diagramId": "3taaalng0ut0" + }, + { + "id": "203", + "name": "collection_members", + "schema": "public", + "x": -338.05774312036385, + "y": -1466.6668409654785, + "fields": [ + { + "id": "204", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778766471107 + }, + { + "id": "205", + "name": "collection_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778766493931 + }, + { + "id": "206", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778766580515 + }, + { + "id": "207", + "name": "access_level", + "type": { + "id": "collection_access_level", + "name": "collection_access_level" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778766832324 + }, + { + "id": "208", + "name": "invited_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778766846050 + }, + { + "id": "209", + "name": "joined_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778766841216 + } + ], + "indexes": [ + { + "id": "210", + "name": "", + "unique": true, + "fieldIds": [ + "204" + ], + "createdAt": 1778766471107, + "isPrimaryKey": true + } + ], + "color": "#9ef07a", + "isView": false, + "createdAt": 1778766471107, + "width": 337, + "order": 38, + "diagramId": "3taaalng0ut0" + }, + { + "id": "211", + "name": "media_collections", + "schema": "public", + "x": 197.36608531341386, + "y": -468.796634019804, + "fields": [ + { + "id": "212", + "name": "collection_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778733152986 + }, + { + "id": "213", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733195744 + }, + { + "id": "214", + "name": "added_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733169676 + }, + { + "id": "215", + "name": "added_at", + "type": { + "id": "bigint", + "name": "bigint" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733189272 + } + ], + "indexes": [ + { + "id": "216", + "name": "index_1", + "unique": true, + "fieldIds": [ + "212", + "213" + ], + "createdAt": 1778733335908 + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1778733152986, + "order": 36, + "diagramId": "3taaalng0ut0" + }, + { + "id": "217", + "name": "user_follows", + "schema": "public", + "x": 200.64283100307347, + "y": -1141.2347344393859, + "fields": [ + { + "id": "218", + "name": "follower_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778401701334 + }, + { + "id": "219", + "name": "following_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778401722682 + }, + { + "id": "220", + "name": "followed_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778401734762 + } + ], + "indexes": [ + { + "id": "221", + "name": "index_1", + "unique": true, + "fieldIds": [ + "219", + "218" + ], + "createdAt": 1778401874053 + } + ], + "checkConstraints": [ + { + "id": "jx7knny2zwx9u3pt9y2eowuoc", + "expression": "follower_id <> following_id", + "createdAt": 1778402111741 + } + ], + "color": "#9ef07a", + "isView": false, + "createdAt": 1778401701334, + "width": 224, + "order": 28, + "diagramId": "3taaalng0ut0" + }, + { + "id": "222", + "name": "media_relations", + "schema": "public", + "x": 194.39903094287618, + "y": -61.06914750749248, + "fields": [ + { + "id": "223", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "224", + "name": "target_media", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777282589092 + }, + { + "id": "225", + "name": "relation", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589092, + "characterMaximumLength": "50" + } + ], + "indexes": [ + { + "id": "226", + "name": "", + "unique": true, + "fieldIds": [ + "223", + "224" + ], + "createdAt": 1777282589092, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589092, + "order": 1, + "diagramId": "3taaalng0ut0" + }, + { + "id": "227", + "name": "media_explicit_genres", + "schema": "public", + "x": -681.3338818918861, + "y": 628.1224828360978, + "fields": [ + { + "id": "228", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777283776082 + }, + { + "id": "229", + "name": "genre_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777283808941 + } + ], + "indexes": [ + { + "id": "230", + "name": "", + "unique": true, + "fieldIds": [ + "228", + "229" + ], + "createdAt": 1777283776082, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777283776082, + "comments": "composite primary key = media_id + genre_id ", + "order": 19, + "diagramId": "3taaalng0ut0" + }, + { + "id": "231", + "name": "media_statuses", + "schema": "public", + "x": -679.4669719043579, + "y": 219.3548090436041, + "fields": [ + { + "id": "232", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "233", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "64" + } + ], + "indexes": [ + { + "id": "234", + "name": "", + "unique": true, + "fieldIds": [ + "232" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 6, + "diagramId": "3taaalng0ut0" + }, + { + "id": "235", + "name": "collections", + "schema": "public", + "x": 206.14708211340167, + "y": -1637.469796851602, + "fields": [ + { + "id": "236", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778733394970 + }, + { + "id": "237", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733410192, + "characterMaximumLength": "64", + "default": null + }, + { + "id": "238", + "name": "cover_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733428870, + "characterMaximumLength": "255" + }, + { + "id": "239", + "name": "privacy_level", + "type": { + "id": "privacy_level", + "name": "privacy_level" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778766528943 + }, + { + "id": "240", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733453130 + }, + { + "id": "241", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778733477620 + } + ], + "indexes": [ + { + "id": "242", + "name": "", + "unique": true, + "fieldIds": [ + "236" + ], + "createdAt": 1778733394970, + "isPrimaryKey": true + } + ], + "color": "#9ef07a", + "isView": false, + "createdAt": 1778733394970, + "order": 37, + "diagramId": "3taaalng0ut0" + }, + { + "id": "243", + "name": "video_services", + "schema": "public", + "x": 78.02893671625938, + "y": 1219.199725842667, + "fields": [ + { + "id": "244", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "245", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094, + "characterMaximumLength": "155" + }, + { + "id": "246", + "name": "resolution", + "type": { + "id": "smallint", + "name": "smallint" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "247", + "name": "domain", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "248", + "name": "image_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "249", + "name": "hex_color", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "10" + }, + { + "id": "250", + "name": "endpoint_video", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "251", + "name": "endpoint_short", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "252", + "name": "endpoint_image", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "253", + "name": "endpoint_download", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "254", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "255", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094 + }, + { + "id": "256", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "257", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + } + ], + "indexes": [ + { + "id": "258", + "name": "", + "unique": true, + "fieldIds": [ + "244" + ], + "createdAt": 1777282589094, + "isPrimaryKey": true + }, + { + "id": "259", + "name": "idx_video_services_name_resolution", + "unique": true, + "fieldIds": [ + "245", + "246" + ], + "createdAt": 1777282589094 + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589094, + "width": 337, + "order": 16, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "260", + "name": "media_licencors", + "schema": "public", + "x": 194.15644602007046, + "y": 251.9575649519487, + "fields": [ + { + "id": "261", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777360331507 + }, + { + "id": "262", + "name": "producer_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777360363236 + } + ], + "indexes": [ + { + "id": "263", + "name": "", + "unique": true, + "fieldIds": [ + "261", + "262" + ], + "createdAt": 1777360331507, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777360331507, + "order": 22, + "diagramId": "3taaalng0ut0" + }, + { + "id": "264", + "name": "user_sessions", + "schema": "public", + "x": -1381.9054198604924, + "y": -1329.3058623634636, + "fields": [ + { + "id": "265", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778814742487 + }, + { + "id": "266", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778814761364 + }, + { + "id": "267", + "name": "device_type", + "type": { + "id": "device_type", + "name": "device_type" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778814807191 + }, + { + "id": "268", + "name": "os_type", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778814771991, + "characterMaximumLength": "50", + "default": null + }, + { + "id": "269", + "name": "os_version", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778814781826, + "characterMaximumLength": "50" + }, + { + "id": "270", + "name": "browser_name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778814787821, + "characterMaximumLength": "50" + }, + { + "id": "271", + "name": "browser_version", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778814794245, + "characterMaximumLength": "50" + }, + { + "id": "272", + "name": "ip_login", + "type": { + "id": "inet", + "name": "inet" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778814801981 + }, + { + "id": "273", + "name": "login_at", + "type": { + "id": "timestamptz", + "name": "timestamptz" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778814816604 + }, + { + "id": "274", + "name": "logout_at", + "type": { + "id": "timestamptz", + "name": "timestamptz" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778814877334 + } + ], + "indexes": [ + { + "id": "275", + "name": "", + "unique": true, + "fieldIds": [ + "265" + ], + "createdAt": 1778814742487, + "isPrimaryKey": true + } + ], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778814742487, + "order": 44, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "276", + "name": "comment_audit_logs", + "schema": "public", + "x": -1031.768269593756, + "y": -322.47738647771854, + "fields": [ + { + "id": "277", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778772275091 + }, + { + "id": "278", + "name": "comment_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772293834 + }, + { + "id": "279", + "name": "performed_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772315274 + }, + { + "id": "280", + "name": "action", + "type": { + "id": "audit_action", + "name": "audit_action" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772326253 + }, + { + "id": "281", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778772335038 + } + ], + "indexes": [ + { + "id": "282", + "name": "", + "unique": true, + "fieldIds": [ + "277" + ], + "createdAt": 1778772275091, + "isPrimaryKey": true + } + ], + "color": "#b067e9", + "isView": false, + "createdAt": 1778772275091, + "order": 40, + "diagramId": "3taaalng0ut0" + }, + { + "id": "283", + "name": "comment_likes", + "schema": "public", + "x": -1435.9285690968027, + "y": 209.11179406446968, + "fields": [ + { + "id": "284", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778808096764 + }, + { + "id": "285", + "name": "comment_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778808185625 + }, + { + "id": "286", + "name": "type", + "type": { + "id": "like_type", + "name": "like_type" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778808192863 + }, + { + "id": "287", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778808284226 + } + ], + "indexes": [ + { + "id": "288", + "name": "index_1", + "unique": true, + "fieldIds": [ + "285", + "284" + ], + "createdAt": 1778808299354 + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1778808096764, + "order": 43, + "diagramId": "3taaalng0ut0" + }, + { + "id": "289", + "name": "video_service_submissions", + "schema": "public", + "x": -371.1847878375677, + "y": 1294.289208047582, + "fields": [ + { + "id": "290", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777362610195 + }, + { + "id": "291", + "name": "video_service_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362624424 + }, + { + "id": "292", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362635996, + "comments": "" + }, + { + "id": "293", + "name": "status", + "type": { + "id": "status_submission", + "name": "status_submission" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777362700148, + "default": "pending", + "comments": "" + }, + { + "id": "294", + "name": "reviewed_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777362758238 + }, + { + "id": "295", + "name": "reviewed_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777363627973 + }, + { + "id": "296", + "name": "reason", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777363674757 + }, + { + "id": "297", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777363686543, + "default": "now()" + } + ], + "indexes": [ + { + "id": "298", + "name": "", + "unique": true, + "fieldIds": [ + "290" + ], + "createdAt": 1777362610195, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777362610195, + "width": 337, + "order": 24, + "diagramId": "3taaalng0ut0" + }, + { + "id": "299", + "name": "provisioned_users", + "schema": "public", + "x": 204.8991215430349, + "y": -1369.625291260797, + "fields": [ + { + "id": "300", + "name": "provisioned_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778517368377 + }, + { + "id": "301", + "name": "provisioned_to", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778517463769 + }, + { + "id": "302", + "name": "provisioned_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778517476998 + }, + { + "id": "303", + "name": "reason", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778517492646, + "characterMaximumLength": "255" + } + ], + "indexes": [], + "color": "#9ef07a", + "isView": false, + "createdAt": 1778517368377, + "order": 30, + "diagramId": "3taaalng0ut0" + }, + { + "id": "304", + "name": "comment_reports", + "schema": "public", + "x": -1032.5934799775514, + "y": -655.2659179217417, + "fields": [ + { + "id": "305", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778777460892 + }, + { + "id": "306", + "name": "reporter_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777475869 + }, + { + "id": "307", + "name": "comment_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777483534 + }, + { + "id": "308", + "name": "title", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777515056, + "characterMaximumLength": "115" + }, + { + "id": "309", + "name": "status", + "type": { + "id": "status_submission", + "name": "status_submission" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777836090 + }, + { + "id": "310", + "name": "description", + "type": { + "id": "text", + "name": "text" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778777519944 + }, + { + "id": "311", + "name": "reported_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778777537682 + }, + { + "id": "312", + "name": "closed_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778777545373 + } + ], + "indexes": [], + "color": "#b067e9", + "isView": false, + "createdAt": 1778777460892, + "order": 42, + "diagramId": "3taaalng0ut0" + }, + { + "id": "313", + "name": "user_preferences", + "schema": "public", + "x": -675.7144111335546, + "y": -1493.2312805453928, + "fields": [ + { + "id": "314", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778517633815 + }, + { + "id": "315", + "name": "character_as_partner", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778518390023 + }, + { + "id": "316", + "name": "comment_picture", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778551730755, + "characterMaximumLength": "255" + }, + { + "id": "317", + "name": "enable_watch_history", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548806729, + "default": "true" + }, + { + "id": "318", + "name": "enable_search_history", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548790804, + "default": "false" + }, + { + "id": "319", + "name": "is_private_account", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778518216561, + "default": "false" + }, + { + "id": "320", + "name": "can_message_me", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778518177601, + "default": "true" + }, + { + "id": "321", + "name": "publish_birthday", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778518242632, + "default": "false" + }, + { + "id": "322", + "name": "publish_email", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778518265111, + "default": "false" + }, + { + "id": "323", + "name": "publish_phone_number", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778518273456, + "default": "false" + }, + { + "id": "324", + "name": "publish_country", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778817885185, + "default": "false" + }, + { + "id": "325", + "name": "publish_partner", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778518357114, + "default": "true" + }, + { + "id": "326", + "name": "subscribe_to_newsletter", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778808434279, + "default": "true" + }, + { + "id": "327", + "name": "enable_security_alerts", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778808466008, + "default": "true" + } + ], + "indexes": [ + { + "id": "328", + "name": "", + "unique": true, + "fieldIds": [ + "314" + ], + "createdAt": 1778517633815, + "isPrimaryKey": true + } + ], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778517633815, + "order": 31, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "329", + "name": "genres", + "schema": "public", + "x": -1033.3879847948956, + "y": 283.68770102274635, + "fields": [ + { + "id": "330", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "331", + "name": "mal_id", + "type": { + "id": "smallint", + "name": "smallint" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "332", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "unique": false, + "nullable": false, + "primaryKey": false, + "createdAt": 1779208587903, + "characterMaximumLength": "100", + "default": null + }, + { + "id": "333", + "name": "slug", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094, + "characterMaximumLength": "115" + }, + { + "id": "334", + "name": "thumbnail_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + } + ], + "indexes": [ + { + "id": "335", + "name": "", + "unique": true, + "fieldIds": [ + "330" + ], + "createdAt": 1777282589094, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589094, + "order": 14, + "diagramId": "3taaalng0ut0" + }, + { + "id": "336", + "name": "user_oauth_accounts", + "schema": "public", + "x": 200.04156829298174, + "y": -928.8832495975014, + "fields": [ + { + "id": "337", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1778516299633 + }, + { + "id": "338", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778516366928 + }, + { + "id": "339", + "name": "provider_name", + "type": { + "id": "oauth_provider", + "name": "oauth_provider" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778822365657 + }, + { + "id": "340", + "name": "provider_sub", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778516403942, + "characterMaximumLength": "255" + }, + { + "id": "341", + "name": "provider_email", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778822096844, + "characterMaximumLength": "255", + "default": null + }, + { + "id": "342", + "name": "access_token", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778516373206, + "characterMaximumLength": "255", + "default": null + }, + { + "id": "343", + "name": "refresh_token", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778822164872, + "characterMaximumLength": "255" + }, + { + "id": "344", + "name": "last_login", + "type": { + "id": "timestamptz", + "name": "timestamptz" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778516872367 + }, + { + "id": "345", + "name": "expires_at", + "type": { + "id": "timestamptz", + "name": "timestamptz" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1778822177415 + }, + { + "id": "346", + "name": "created_at", + "type": { + "id": "timestamptz", + "name": "timestamptz" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778822183677 + }, + { + "id": "347", + "name": "updated_at", + "type": { + "id": "timestamptz", + "name": "timestamptz" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778822185523 + } + ], + "indexes": [ + { + "id": "348", + "name": "", + "unique": true, + "fieldIds": [ + "337" + ], + "createdAt": 1778516299633, + "isPrimaryKey": true + }, + { + "id": "349", + "name": "index_2", + "unique": true, + "fieldIds": [ + "338", + "339" + ], + "createdAt": 1778516903425 + } + ], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778516299633, + "order": 29, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "350", + "name": "episodes", + "schema": "public", + "x": 196.42495741544377, + "y": 550.6255135491608, + "fields": [ + { + "id": "351", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "352", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "353", + "name": "episode", + "type": { + "id": "smallint", + "name": "smallint" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "354", + "name": "mal_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "355", + "name": "mal_forum_url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "255" + }, + { + "id": "356", + "name": "title", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "155" + }, + { + "id": "357", + "name": "title_origin", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "155" + }, + { + "id": "358", + "name": "title_romanji", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093, + "characterMaximumLength": "155" + }, + { + "id": "359", + "name": "aired", + "type": { + "id": "date", + "name": "date" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "360", + "name": "filler", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "default": "false" + }, + { + "id": "361", + "name": "recap", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "default": "false" + }, + { + "id": "362", + "name": "total_score", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777361135322 + }, + { + "id": "363", + "name": "scored_by", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777361233825 + }, + { + "id": "364", + "name": "videos", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "365", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589093 + }, + { + "id": "366", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "367", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + } + ], + "indexes": [ + { + "id": "368", + "name": "", + "unique": true, + "fieldIds": [ + "351" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589093, + "order": 9, + "expanded": true, + "diagramId": "3taaalng0ut0" + }, + { + "id": "369", + "name": "media_sources", + "schema": "public", + "x": -680.0105470895069, + "y": 97.06852307742538, + "fields": [ + { + "id": "370", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "371", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "18" + } + ], + "indexes": [ + { + "id": "372", + "name": "", + "unique": true, + "fieldIds": [ + "370" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777282589093, + "order": 5, + "diagramId": "3taaalng0ut0" + }, + { + "id": "373", + "name": "media_producers", + "schema": "public", + "x": 194.9363737010458, + "y": 104.92238147821836, + "fields": [ + { + "id": "374", + "name": "media_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777360177611 + }, + { + "id": "375", + "name": "producer_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": false, + "nullable": false, + "createdAt": 1777360209223 + } + ], + "indexes": [ + { + "id": "376", + "name": "", + "unique": true, + "fieldIds": [ + "374", + "375" + ], + "createdAt": 1777360177611, + "isPrimaryKey": true + } + ], + "color": "#ffe374", + "isView": false, + "createdAt": 1777360177611, + "order": 21, + "diagramId": "3taaalng0ut0" + }, + { + "id": "377", + "name": "videos", + "schema": "public", + "x": 613.6042418109826, + "y": 563.9662290869784, + "fields": [ + { + "id": "378", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "379", + "name": "service_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "380", + "name": "video_code", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "381", + "name": "short_code", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "382", + "name": "thumbnail_code", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "383", + "name": "download_code", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "384", + "name": "pending_upload", + "type": { + "id": "boolean", + "name": "boolean" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "default": "true" + }, + { + "id": "385", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "386", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094 + }, + { + "id": "387", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "388", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + } + ], + "indexes": [ + { + "id": "389", + "name": "", + "unique": true, + "fieldIds": [ + "378" + ], + "createdAt": 1777282589094, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589094, + "order": 15, + "diagramId": "3taaalng0ut0" + }, + { + "id": "390", + "name": "producers", + "schema": "public", + "x": 614.2665328827337, + "y": 137.7660218436568, + "fields": [ + { + "id": "391", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "392", + "name": "mal_id", + "type": { + "id": "int", + "name": "int" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "393", + "name": "type", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "24" + }, + { + "id": "394", + "name": "name", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094, + "characterMaximumLength": "155" + }, + { + "id": "395", + "name": "url", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094, + "characterMaximumLength": "255" + }, + { + "id": "396", + "name": "created_by", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "397", + "name": "deleted_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": true, + "createdAt": 1777282589094 + }, + { + "id": "398", + "name": "updated_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + }, + { + "id": "399", + "name": "created_at", + "type": { + "id": "timestamp", + "name": "timestamp" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589094 + } + ], + "indexes": [ + { + "id": "400", + "name": "", + "unique": true, + "fieldIds": [ + "391" + ], + "createdAt": 1777282589094, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589094, + "order": 13, + "diagramId": "3taaalng0ut0" + }, + { + "id": "401", + "name": "voice_actors", + "schema": "public", + "x": -1034.5971892955995, + "y": 536.4407371208936, + "fields": [ + { + "id": "402", + "name": "id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": true, + "unique": true, + "nullable": false, + "createdAt": 1777282589093 + }, + { + "id": "403", + "name": "media_character_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "unique": false, + "nullable": false, + "primaryKey": false, + "createdAt": 1779379833155 + }, + { + "id": "404", + "name": "language", + "type": { + "id": "varchar", + "name": "varchar" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093, + "characterMaximumLength": "115" + }, + { + "id": "405", + "name": "actor_staff", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1777282589093 + } + ], + "indexes": [ + { + "id": "406", + "name": "", + "unique": true, + "fieldIds": [ + "402" + ], + "createdAt": 1777282589093, + "isPrimaryKey": true + } + ], + "color": "#ff9f74", + "isView": false, + "createdAt": 1777282589093, + "order": 11, + "diagramId": "3taaalng0ut0" + }, + { + "id": "407", + "name": "user_genre_preferences", + "schema": "public", + "x": -1033.5708487432953, + "y": -1502.401339834144, + "fields": [ + { + "id": "408", + "name": "user_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": true, + "nullable": false, + "createdAt": 1778548513047 + }, + { + "id": "409", + "name": "genre_id", + "type": { + "id": "uuid", + "name": "uuid" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548529915 + }, + { + "id": "410", + "name": "state", + "type": { + "id": "user_preference_state", + "name": "user_preference_state" + }, + "primaryKey": false, + "unique": false, + "nullable": false, + "createdAt": 1778548535529 + } + ], + "indexes": [ + { + "id": "411", + "name": "index_1", + "unique": true, + "fieldIds": [ + "408", + "409" + ], + "createdAt": 1778548614328 + } + ], + "color": "#4dee8a", + "isView": false, + "createdAt": 1778548513047, + "order": 31, + "diagramId": "3taaalng0ut0" + } + ], + "relationships": [ + { + "id": "412", + "name": "collection_members_collection_id_fk", + "sourceSchema": "public", + "sourceTableId": "235", + "targetSchema": "public", + "targetTableId": "203", + "sourceFieldId": "236", + "targetFieldId": "205", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778766565819, + "diagramId": "3taaalng0ut0" + }, + { + "id": "413", + "name": "collection_members_invited_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "203", + "sourceFieldId": "158", + "targetFieldId": "208", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778766863110, + "diagramId": "3taaalng0ut0" + }, + { + "id": "414", + "name": "collection_members_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "203", + "sourceFieldId": "158", + "targetFieldId": "206", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778766807732, + "diagramId": "3taaalng0ut0" + }, + { + "id": "415", + "name": "comment_audit_logs_comment_id_fk", + "sourceSchema": "public", + "sourceTableId": "126", + "targetSchema": "public", + "targetTableId": "276", + "sourceFieldId": "127", + "targetFieldId": "278", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778777327740, + "diagramId": "3taaalng0ut0" + }, + { + "id": "416", + "name": "comment_audit_logs_performed_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "276", + "sourceFieldId": "158", + "targetFieldId": "279", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778777342519, + "diagramId": "3taaalng0ut0" + }, + { + "id": "417", + "name": "comment_likes_comment_id_fk", + "sourceSchema": "public", + "sourceTableId": "126", + "targetSchema": "public", + "targetTableId": "283", + "sourceFieldId": "127", + "targetFieldId": "285", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778808350916, + "diagramId": "3taaalng0ut0" + }, + { + "id": "418", + "name": "comment_likes_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "283", + "sourceFieldId": "80", + "targetFieldId": "284", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778808338630, + "diagramId": "3taaalng0ut0" + }, + { + "id": "419", + "name": "comment_reports_comment_id_fk", + "sourceSchema": "public", + "sourceTableId": "126", + "targetSchema": "public", + "targetTableId": "304", + "sourceFieldId": "127", + "targetFieldId": "307", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778777586444, + "diagramId": "3taaalng0ut0" + }, + { + "id": "420", + "name": "comment_reports_reporter_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "304", + "sourceFieldId": "158", + "targetFieldId": "306", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778777570446, + "diagramId": "3taaalng0ut0" + }, + { + "id": "421", + "name": "comments_episode_id_fk", + "sourceSchema": "public", + "sourceTableId": "350", + "targetSchema": "public", + "targetTableId": "126", + "sourceFieldId": "351", + "targetFieldId": "129", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778777292243, + "diagramId": "3taaalng0ut0" + }, + { + "id": "422", + "name": "comments_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "126", + "sourceFieldId": "158", + "targetFieldId": "128", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778777252269, + "diagramId": "3taaalng0ut0" + }, + { + "id": "423", + "name": "episodes_media_id_medias_id", + "sourceSchema": "public", + "sourceTableId": "350", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "352", + "targetFieldId": "80", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "424", + "name": "episodes_videos_videos_id", + "sourceSchema": "public", + "sourceTableId": "350", + "targetSchema": "public", + "targetTableId": "377", + "sourceFieldId": "364", + "targetFieldId": "378", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777282589095, + "diagramId": "3taaalng0ut0" + }, + { + "id": "425", + "name": "genre_selected_genre_id_fk", + "sourceSchema": "public", + "sourceTableId": "329", + "targetSchema": "public", + "targetTableId": "407", + "sourceFieldId": "330", + "targetFieldId": "409", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778548598785, + "diagramId": "3taaalng0ut0" + }, + { + "id": "426", + "name": "genre_selected_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "313", + "targetSchema": "public", + "targetTableId": "407", + "sourceFieldId": "314", + "targetFieldId": "408", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778548583401, + "diagramId": "3taaalng0ut0" + }, + { + "id": "427", + "name": "genres_id_fk", + "sourceSchema": "public", + "sourceTableId": "329", + "targetSchema": "public", + "targetTableId": "75", + "sourceFieldId": "330", + "targetFieldId": "77", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777295361546, + "diagramId": "3taaalng0ut0" + }, + { + "id": "428", + "name": "home_media_banner_created_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "50", + "sourceFieldId": "158", + "targetFieldId": "53", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778771806907, + "diagramId": "3taaalng0ut0" + }, + { + "id": "429", + "name": "home_media_banner_media_id_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "50", + "sourceFieldId": "80", + "targetFieldId": "52", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778771781222, + "diagramId": "3taaalng0ut0" + }, + { + "id": "430", + "name": "media_characters_characters_characters_id", + "sourceSchema": "public", + "sourceTableId": "33", + "targetSchema": "public", + "targetTableId": "5", + "sourceFieldId": "36", + "targetFieldId": "6", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "431", + "name": "media_characters_voice_actor_fk", + "sourceSchema": "public", + "sourceTableId": "33", + "targetSchema": "public", + "targetTableId": "401", + "sourceFieldId": "38", + "targetFieldId": "403", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1779379852942, + "diagramId": "3taaalng0ut0" + }, + { + "id": "432", + "name": "media_collections_added_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "211", + "sourceFieldId": "158", + "targetFieldId": "214", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778733368958, + "diagramId": "3taaalng0ut0" + }, + { + "id": "433", + "name": "media_collections_collection_id_fk", + "sourceSchema": "public", + "sourceTableId": "235", + "targetSchema": "public", + "targetTableId": "211", + "sourceFieldId": "236", + "targetFieldId": "212", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778733702652, + "diagramId": "3taaalng0ut0" + }, + { + "id": "434", + "name": "media_demographics_genre_id_fk", + "sourceSchema": "public", + "sourceTableId": "329", + "targetSchema": "public", + "targetTableId": "1", + "sourceFieldId": "330", + "targetFieldId": "3", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1779211061425, + "diagramId": "3taaalng0ut0" + }, + { + "id": "435", + "name": "media_explicit_genres_genre_id_fk", + "sourceSchema": "public", + "sourceTableId": "329", + "targetSchema": "public", + "targetTableId": "227", + "sourceFieldId": "330", + "targetFieldId": "229", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777283900006, + "diagramId": "3taaalng0ut0" + }, + { + "id": "436", + "name": "media_explicit_genres_media_id_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "227", + "sourceFieldId": "109", + "targetFieldId": "228", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777283887322, + "diagramId": "3taaalng0ut0" + }, + { + "id": "437", + "name": "media_external_links_media_id_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "59", + "sourceFieldId": "80", + "targetFieldId": "61", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777299855251, + "diagramId": "3taaalng0ut0" + }, + { + "id": "438", + "name": "media_external_links_media_id_medias_id", + "sourceSchema": "public", + "sourceTableId": "59", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "61", + "targetFieldId": "80", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "439", + "name": "media_genres_genre_id_fk", + "sourceSchema": "public", + "sourceTableId": "329", + "targetSchema": "public", + "targetTableId": "16", + "sourceFieldId": "330", + "targetFieldId": "18", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777283616203, + "diagramId": "3taaalng0ut0" + }, + { + "id": "440", + "name": "media_genres_media_id_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "16", + "sourceFieldId": "108", + "targetFieldId": "17", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777283611719, + "diagramId": "3taaalng0ut0" + }, + { + "id": "441", + "name": "media_producers_producer_id_fk", + "sourceSchema": "public", + "sourceTableId": "390", + "targetSchema": "public", + "targetTableId": "373", + "sourceFieldId": "391", + "targetFieldId": "375", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777360252829, + "diagramId": "3taaalng0ut0" + }, + { + "id": "442", + "name": "media_relations_target_media_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "222", + "sourceFieldId": "80", + "targetFieldId": "224", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777299808576, + "diagramId": "3taaalng0ut0" + }, + { + "id": "443", + "name": "media_relations_target_media_fk", + "sourceSchema": "public", + "sourceTableId": "222", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "224", + "targetFieldId": "80", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1777299804996, + "diagramId": "3taaalng0ut0" + }, + { + "id": "444", + "name": "media_relations_target_media_fk", + "sourceSchema": "public", + "sourceTableId": "222", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "224", + "targetFieldId": "80", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1777299795695, + "diagramId": "3taaalng0ut0" + }, + { + "id": "445", + "name": "media_relations_target_media_medias_id", + "sourceSchema": "public", + "sourceTableId": "222", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "224", + "targetFieldId": "80", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "446", + "name": "media_submissions_media_id_fk", + "sourceSchema": "public", + "sourceTableId": "40", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "42", + "targetFieldId": "80", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777636061160, + "diagramId": "3taaalng0ut0" + }, + { + "id": "447", + "name": "media_submissions_media_id_fk", + "sourceSchema": "public", + "sourceTableId": "40", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "42", + "targetFieldId": "80", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1777364362256, + "diagramId": "3taaalng0ut0" + }, + { + "id": "448", + "name": "media_types_id_medias_type", + "sourceSchema": "public", + "sourceTableId": "148", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "149", + "targetFieldId": "91", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "449", + "name": "medias_age_rating_media_age_ratings_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "189", + "sourceFieldId": "97", + "targetFieldId": "190", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "450", + "name": "medias_characters_media_characters_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "33", + "sourceFieldId": "114", + "targetFieldId": "35", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "451", + "name": "medias_country_fk", + "sourceSchema": "public", + "sourceTableId": "21", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "22", + "targetFieldId": "103", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778402285202, + "diagramId": "3taaalng0ut0" + }, + { + "id": "452", + "name": "medias_demographics_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "1", + "sourceFieldId": "111", + "targetFieldId": "2", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1779211057969, + "diagramId": "3taaalng0ut0" + }, + { + "id": "453", + "name": "medias_external_links_media_external_links_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "59", + "sourceFieldId": "113", + "targetFieldId": "60", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "454", + "name": "medias_id_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "211", + "sourceFieldId": "80", + "targetFieldId": "213", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778733359073, + "diagramId": "3taaalng0ut0" + }, + { + "id": "455", + "name": "medias_licensors_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "260", + "sourceFieldId": "106", + "targetFieldId": "261", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777360403880, + "diagramId": "3taaalng0ut0" + }, + { + "id": "456", + "name": "medias_producers_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "373", + "sourceFieldId": "105", + "targetFieldId": "374", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777360239834, + "diagramId": "3taaalng0ut0" + }, + { + "id": "457", + "name": "medias_relations_media_relations_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "222", + "sourceFieldId": "112", + "targetFieldId": "223", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "458", + "name": "medias_source_media_sources_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "369", + "sourceFieldId": "92", + "targetFieldId": "370", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "459", + "name": "medias_status_media_statuses_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "231", + "sourceFieldId": "93", + "targetFieldId": "232", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "460", + "name": "medias_studios_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "122", + "sourceFieldId": "107", + "targetFieldId": "123", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777360574406, + "diagramId": "3taaalng0ut0" + }, + { + "id": "461", + "name": "medias_themes_fk", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "75", + "sourceFieldId": "110", + "targetFieldId": "76", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777295350412, + "diagramId": "3taaalng0ut0" + }, + { + "id": "462", + "name": "medias_trailers_media_trailers_id", + "sourceSchema": "public", + "sourceTableId": "79", + "targetSchema": "public", + "targetTableId": "194", + "sourceFieldId": "86", + "targetFieldId": "195", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "463", + "name": "producers_id_fk", + "sourceSchema": "public", + "sourceTableId": "390", + "targetSchema": "public", + "targetTableId": "122", + "sourceFieldId": "391", + "targetFieldId": "124", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777360597827, + "diagramId": "3taaalng0ut0" + }, + { + "id": "464", + "name": "producers_id_fk", + "sourceSchema": "public", + "sourceTableId": "390", + "targetSchema": "public", + "targetTableId": "260", + "sourceFieldId": "391", + "targetFieldId": "262", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1777360416280, + "diagramId": "3taaalng0ut0" + }, + { + "id": "465", + "name": "provisioned_users_provisioned_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "299", + "sourceFieldId": "158", + "targetFieldId": "300", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778517515380, + "diagramId": "3taaalng0ut0" + }, + { + "id": "466", + "name": "provisioned_users_provisioned_to_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "299", + "sourceFieldId": "158", + "targetFieldId": "301", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778517541887, + "diagramId": "3taaalng0ut0" + }, + { + "id": "467", + "name": "rating_selected_rating_id_fk", + "sourceSchema": "public", + "sourceTableId": "189", + "targetSchema": "public", + "targetTableId": "144", + "sourceFieldId": "190", + "targetFieldId": "146", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778548767353, + "diagramId": "3taaalng0ut0" + }, + { + "id": "468", + "name": "rating_selected_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "313", + "targetSchema": "public", + "targetTableId": "144", + "sourceFieldId": "314", + "targetFieldId": "145", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778548748682, + "diagramId": "3taaalng0ut0" + }, + { + "id": "469", + "name": "user_addresses_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "65", + "targetSchema": "public", + "targetTableId": "157", + "sourceFieldId": "66", + "targetFieldId": "158", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1778816615538, + "diagramId": "3taaalng0ut0" + }, + { + "id": "470", + "name": "user_country_preferences_country_id_fk", + "sourceSchema": "public", + "sourceTableId": "21", + "targetSchema": "public", + "targetTableId": "29", + "sourceFieldId": "22", + "targetFieldId": "31", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778549061296, + "diagramId": "3taaalng0ut0" + }, + { + "id": "471", + "name": "user_country_preferences_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "313", + "targetSchema": "public", + "targetTableId": "29", + "sourceFieldId": "314", + "targetFieldId": "30", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778549044482, + "diagramId": "3taaalng0ut0" + }, + { + "id": "472", + "name": "user_follows_follower_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "217", + "sourceFieldId": "158", + "targetFieldId": "218", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778402073659, + "diagramId": "3taaalng0ut0" + }, + { + "id": "473", + "name": "user_follows_following_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "217", + "sourceFieldId": "158", + "targetFieldId": "219", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778402077836, + "diagramId": "3taaalng0ut0" + }, + { + "id": "474", + "name": "user_oauth_credentials_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "336", + "sourceFieldId": "158", + "targetFieldId": "338", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778822260934, + "diagramId": "3taaalng0ut0" + }, + { + "id": "475", + "name": "user_preferences_character_as_partner_fk", + "sourceSchema": "public", + "sourceTableId": "5", + "targetSchema": "public", + "targetTableId": "313", + "sourceFieldId": "6", + "targetFieldId": "315", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778518451836, + "diagramId": "3taaalng0ut0" + }, + { + "id": "476", + "name": "user_preferences_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "313", + "targetSchema": "public", + "targetTableId": "157", + "sourceFieldId": "314", + "targetFieldId": "158", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1778517654898, + "diagramId": "3taaalng0ut0" + }, + { + "id": "477", + "name": "user_sessions_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "264", + "sourceFieldId": "158", + "targetFieldId": "266", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778815073839, + "diagramId": "3taaalng0ut0" + }, + { + "id": "478", + "name": "user_watch_histories_episode_id_fk", + "sourceSchema": "public", + "sourceTableId": "350", + "targetSchema": "public", + "targetTableId": "152", + "sourceFieldId": "351", + "targetFieldId": "154", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778732139998, + "diagramId": "3taaalng0ut0" + }, + { + "id": "479", + "name": "user_watch_histories_user_id_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "152", + "sourceFieldId": "158", + "targetFieldId": "153", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778731708617, + "diagramId": "3taaalng0ut0" + }, + { + "id": "480", + "name": "users_country_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "21", + "sourceFieldId": "169", + "targetFieldId": "22", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1778401651979, + "diagramId": "3taaalng0ut0" + }, + { + "id": "481", + "name": "video_service_submissions_video_service_id_fk", + "sourceSchema": "public", + "sourceTableId": "289", + "targetSchema": "public", + "targetTableId": "243", + "sourceFieldId": "291", + "targetFieldId": "244", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1777364068966, + "diagramId": "3taaalng0ut0" + }, + { + "id": "482", + "name": "video_submissions_created_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "179", + "sourceFieldId": "158", + "targetFieldId": "182", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778732667055, + "diagramId": "3taaalng0ut0" + }, + { + "id": "483", + "name": "video_submissions_reviewed_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "179", + "sourceFieldId": "158", + "targetFieldId": "183", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1778732708490, + "diagramId": "3taaalng0ut0" + }, + { + "id": "484", + "name": "video_submissions_video_id_fk", + "sourceSchema": "public", + "sourceTableId": "179", + "targetSchema": "public", + "targetTableId": "377", + "sourceFieldId": "181", + "targetFieldId": "378", + "sourceCardinality": "one", + "targetCardinality": "one", + "createdAt": 1778732648012, + "diagramId": "3taaalng0ut0" + }, + { + "id": "485", + "name": "videos_service_id_video_services_id", + "sourceSchema": "public", + "sourceTableId": "377", + "targetSchema": "public", + "targetTableId": "243", + "sourceFieldId": "379", + "targetFieldId": "244", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589095, + "diagramId": "3taaalng0ut0" + }, + { + "id": "486", + "name": "voice_actors_actor_staff_staff_id", + "sourceSchema": "public", + "sourceTableId": "401", + "targetSchema": "public", + "targetTableId": "135", + "sourceFieldId": "405", + "targetFieldId": "136", + "sourceCardinality": "many", + "targetCardinality": "one", + "createdAt": 1777282589094, + "diagramId": "3taaalng0ut0" + }, + { + "id": "487", + "name": "medias_deleted_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "158", + "targetFieldId": "119", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1779410452620 + }, + { + "id": "488", + "name": "medias_updated_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "158", + "targetFieldId": "117", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1779410488128 + }, + { + "id": "489", + "name": "medias_created_by_fk", + "sourceSchema": "public", + "sourceTableId": "157", + "targetSchema": "public", + "targetTableId": "79", + "sourceFieldId": "158", + "targetFieldId": "115", + "sourceCardinality": "one", + "targetCardinality": "many", + "createdAt": 1779410515297 + } + ], + "dependencies": [], + "areas": [], + "customTypes": [ + { + "id": "490", + "name": "audit_action", + "kind": "enum", + "values": [ + "delete", + "restore", + "edit", + "flag" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "491", + "name": "collection_access_level", + "kind": "enum", + "values": [ + "viewer", + "contributor", + "moderator", + "owner" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "492", + "name": "device_type", + "kind": "enum", + "values": [ + "mobile", + "tablet", + "desktop", + "unknown" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "493", + "name": "like_type", + "kind": "enum", + "values": [ + "like", + "dislike" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "494", + "name": "media_season", + "kind": "enum", + "values": [ + "winter", + "spring", + "summer", + "fall" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "495", + "name": "oauth_provider", + "kind": "enum", + "values": [ + "google", + "github" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "496", + "name": "privacy_level", + "kind": "enum", + "values": [ + "private", + "unlisted", + "public" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "497", + "name": "status_submission", + "kind": "enum", + "values": [ + "pending", + "approved", + "rejected" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "498", + "name": "user_preference_state", + "kind": "enum", + "values": [ + "exclude", + "include" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "499", + "name": "user_role", + "kind": "enum", + "values": [ + "user", + "contributor", + "curator", + "administrator" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + }, + { + "id": "500", + "name": "user_sex", + "kind": "enum", + "values": [ + "female", + "male" + ], + "fields": [], + "diagramId": "3taaalng0ut0" + } + ], + "notes": [] +} \ No newline at end of file diff --git a/prisma/migrations/000_baseline_v2/migration.sql b/prisma/migrations/000_baseline_v2/migration.sql deleted file mode 100644 index 52c20b1..0000000 --- a/prisma/migrations/000_baseline_v2/migration.sql +++ /dev/null @@ -1,903 +0,0 @@ --- CreateSchema -CREATE SCHEMA IF NOT EXISTS "public"; - --- CreateEnum -CREATE TYPE "MediaType" AS ENUM ('TV', 'ONA', 'OVA', 'Movie', 'Special', 'Music'); - --- CreateEnum -CREATE TYPE "Country" AS ENUM ('Japanese', 'English', 'Indonesia', 'Korea'); - --- CreateEnum -CREATE TYPE "Season" AS ENUM ('Winter', 'Spring', 'Summer', 'Fall'); - --- CreateEnum -CREATE TYPE "CharacterRole" AS ENUM ('Main', 'Supporting'); - --- CreateEnum -CREATE TYPE "MediaOperation" AS ENUM ('create', 'update', 'delete'); - --- CreateEnum -CREATE TYPE "UserGender" AS ENUM ('male', 'female'); - --- CreateEnum -CREATE TYPE "AdultFiltering" AS ENUM ('hide', 'show', 'explicit'); - --- CreateEnum -CREATE TYPE "AdultAlert" AS ENUM ('hide', 'show'); - --- CreateEnum -CREATE TYPE "VideoQuality" AS ENUM ('Q2160', 'Q1440', 'Q1080', 'Q720', 'Q480', 'Q360', 'Q240', 'Q144'); - --- CreateEnum -CREATE TYPE "UserNotificationState" AS ENUM ('info', 'warning', 'danger'); - --- CreateEnum -CREATE TYPE "ReportStatus" AS ENUM ('pending', 'resolved', 'rejected'); - --- CreateEnum -CREATE TYPE "ReportReason" AS ENUM ('sexualize', 'violent', 'explicit', 'hateful', 'political', 'racist', 'spam', 'other'); - --- CreateEnum -CREATE TYPE "AccessStatus" AS ENUM ('private', 'selected', 'protected', 'public'); - --- CreateEnum -CREATE TYPE "AccessScope" AS ENUM ('viewer', 'editor'); - --- CreateEnum -CREATE TYPE "MediaReviewReaction" AS ENUM ('angry', 'sad', 'awesome', 'happy', 'sleepy', 'annoyed', 'disgusting', 'disappointed'); - --- CreateEnum -CREATE TYPE "EmailPorpose" AS ENUM ('forgot_password', 'account_activation', 'account_notification', 'subscribtion'); - --- CreateEnum -CREATE TYPE "TypeSystemNotification" AS ENUM ('component', 'popup', 'toast'); - --- CreateTable -CREATE TABLE "medias" ( - "id" UUID NOT NULL, - "title" TEXT NOT NULL, - "titleAlternative" JSONB NOT NULL, - "slug" TEXT NOT NULL, - "malId" INTEGER, - "pictureMedium" TEXT NOT NULL, - "pictureLarge" TEXT NOT NULL, - "country" "Country" NOT NULL DEFAULT 'Japanese', - "score" DECIMAL(4,2) NOT NULL DEFAULT 0.00, - "status" TEXT NOT NULL, - "startAiring" TIMESTAMP(3), - "endAiring" TIMESTAMP(3), - "synopsis" TEXT NOT NULL, - "ageRating" TEXT NOT NULL, - "mediaType" "MediaType" NOT NULL, - "source" TEXT, - "onDraft" BOOLEAN NOT NULL DEFAULT true, - "uploadedBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "season" "Season", - "yearReleased" SMALLINT NOT NULL, - - CONSTRAINT "medias_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "media_logs" ( - "id" UUID NOT NULL, - "status" "MediaOperation" NOT NULL, - "approval" BOOLEAN NOT NULL DEFAULT false, - "proposedBy" UUID NOT NULL, - "approvedBy" UUID NOT NULL, - "mediaId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "media_logs_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "genres" ( - "id" UUID NOT NULL, - "name" VARCHAR(255) NOT NULL, - "slug" VARCHAR(255) NOT NULL, - "malId" INTEGER NOT NULL, - "malUrl" VARCHAR(255) NOT NULL, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "genres_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "studios" ( - "id" UUID NOT NULL, - "name" VARCHAR(255) NOT NULL, - "slug" VARCHAR(255) NOT NULL, - "linkAbout" TEXT NOT NULL, - "malId" INTEGER NOT NULL, - "logoUrl" TEXT, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "studios_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "characters" ( - "id" UUID NOT NULL, - "malId" INTEGER NOT NULL, - "name" TEXT NOT NULL, - "role" "CharacterRole" NOT NULL, - "favorites" INTEGER NOT NULL DEFAULT 0, - "imageUrl" TEXT, - "smallImageUrl" TEXT, - "creatorId" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "characters_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "voice_actors" ( - "id" UUID NOT NULL, - "malId" INTEGER NOT NULL, - "name" TEXT NOT NULL, - "birthday" TIMESTAMP(3), - "description" TEXT, - "aboutUrl" TEXT, - "imageUrl" TEXT, - "websiteUrl" TEXT, - "creatorId" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "voice_actors_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "lang_va_char" ( - "id" UUID NOT NULL, - "language" TEXT NOT NULL, - "vaId" UUID NOT NULL, - "charId" UUID NOT NULL, - "creatorId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "lang_va_char_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "episodes" ( - "id" UUID NOT NULL, - "mediaId" UUID NOT NULL, - "episode" INTEGER NOT NULL, - "name" VARCHAR(255) NOT NULL, - "score" DECIMAL(4,2) NOT NULL DEFAULT 0.00, - "pictureThumbnail" TEXT, - "viewed" BIGINT NOT NULL DEFAULT 0, - "likes" BIGINT NOT NULL DEFAULT 0, - "dislikes" BIGINT NOT NULL DEFAULT 0, - "pendingUpload" BOOLEAN NOT NULL DEFAULT true, - "uploadedBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "episodes_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "episode_likes" ( - "id" UUID NOT NULL, - "userId" UUID NOT NULL, - "sessionId" UUID NOT NULL, - "episodeId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "episode_likes_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "videos" ( - "id" UUID NOT NULL, - "episodeId" UUID NOT NULL, - "serviceId" UUID NOT NULL, - "videoCode" VARCHAR(255) NOT NULL, - "thumbnailCode" TEXT, - "pendingUpload" BOOLEAN NOT NULL DEFAULT true, - "uploadedBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "videos_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "video_services" ( - "id" UUID NOT NULL, - "name" VARCHAR(255) NOT NULL, - "domain" VARCHAR(255) NOT NULL, - "logo" TEXT, - "hexColor" VARCHAR(10) NOT NULL, - "endpointVideo" TEXT NOT NULL, - "endpointThumbnail" TEXT, - "endpointDownload" TEXT, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "video_services_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "users" ( - "id" UUID NOT NULL, - "name" VARCHAR(255) NOT NULL, - "username" VARCHAR(255) NOT NULL, - "email" TEXT NOT NULL, - "password" TEXT NOT NULL, - "birthDate" DATE, - "gender" "UserGender", - "phoneCC" INTEGER, - "phoneNumber" INTEGER, - "bioProfile" TEXT, - "avatar" TEXT, - "commentBackground" TEXT, - "provider" VARCHAR(255), - "providerId" VARCHAR(255), - "providerToken" TEXT, - "providerPayload" JSON, - "verifiedAt" TIMESTAMP(3), - "disabledAt" TIMESTAMP(3), - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "users_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "user_preferences" ( - "id" UUID NOT NULL, - "userId" UUID NOT NULL, - "langPreference" TEXT, - "adultFiltering" "AdultFiltering" NOT NULL DEFAULT 'hide', - "adultAlert" "AdultAlert" NOT NULL DEFAULT 'show', - "videoQuality" "VideoQuality" NOT NULL DEFAULT 'Q1080', - "serviceDefaultId" UUID, - "hideContries" "Country"[], - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "user_preferences_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "user_roles" ( - "id" UUID NOT NULL, - "name" VARCHAR(255) NOT NULL, - "description" TEXT, - "primaryColor" VARCHAR(10), - "secondaryColor" VARCHAR(10), - "pictureImage" TEXT, - "badgeImage" TEXT, - "isSuperadmin" BOOLEAN NOT NULL DEFAULT false, - "canEditMedia" BOOLEAN NOT NULL DEFAULT false, - "canManageMedia" BOOLEAN NOT NULL DEFAULT false, - "canEditEpisodes" BOOLEAN NOT NULL DEFAULT false, - "canManageEpisodes" BOOLEAN NOT NULL DEFAULT false, - "canEditComment" BOOLEAN NOT NULL DEFAULT false, - "canManageComment" BOOLEAN NOT NULL DEFAULT false, - "canEditUser" BOOLEAN NOT NULL DEFAULT false, - "canManageUser" BOOLEAN NOT NULL DEFAULT false, - "canEditSystem" BOOLEAN NOT NULL DEFAULT false, - "canManageSystem" BOOLEAN NOT NULL DEFAULT false, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "user_roles_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "user_role_assignments" ( - "userId" UUID NOT NULL, - "roleId" UUID NOT NULL, - "assignmentAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "user_role_assignments_pkey" PRIMARY KEY ("userId","roleId") -); - --- CreateTable -CREATE TABLE "user_notifications" ( - "id" UUID NOT NULL, - "title" VARCHAR(255) NOT NULL, - "content" TEXT NOT NULL, - "picture" TEXT NOT NULL, - "state" "UserNotificationState" NOT NULL, - "ctaLink" TEXT NOT NULL, - "userId" UUID NOT NULL, - "isReaded" BOOLEAN NOT NULL DEFAULT false, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "user_notifications_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "user_sessions" ( - "id" UUID NOT NULL, - "isAuthenticated" BOOLEAN NOT NULL DEFAULT false, - "userId" UUID NOT NULL, - "deviceType" VARCHAR(255) NOT NULL, - "deviceOs" VARCHAR(255) NOT NULL, - "deviceIp" VARCHAR(255) NOT NULL, - "browser" VARCHAR(255) NOT NULL, - "isOnline" BOOLEAN NOT NULL DEFAULT false, - "lastOnline" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "validUntil" TIMESTAMP(3) NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "user_sessions_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "user_logs" ( - "id" UUID NOT NULL, - "title" VARCHAR(255) NOT NULL, - "notes" TEXT NOT NULL, - "userId" UUID NOT NULL, - "sessionId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "user_logs_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "collections" ( - "id" UUID NOT NULL, - "name" VARCHAR(115) NOT NULL, - "ownerId" UUID NOT NULL, - "accessStatus" "AccessStatus" NOT NULL DEFAULT 'private', - "password" VARCHAR(255), - "accessScope" "AccessScope" NOT NULL DEFAULT 'viewer', - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "slug" VARCHAR(115) NOT NULL, - - CONSTRAINT "collections_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "CollectionMedia" ( - "id" UUID NOT NULL, - "collectionId" UUID NOT NULL, - "mediaId" UUID NOT NULL, - "savedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "CollectionMedia_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "watch_histories" ( - "id" UUID NOT NULL, - "episodeId" UUID NOT NULL, - "userId" UUID NOT NULL, - "sessionId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "watch_histories_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "movie_reviews" ( - "id" UUID NOT NULL, - "mediaId" UUID NOT NULL, - "rating" INTEGER NOT NULL, - "title" VARCHAR(255) NOT NULL, - "text" TEXT NOT NULL, - "reaction" "MediaReviewReaction" NOT NULL, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "movie_reviews_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "comments" ( - "id" UUID NOT NULL, - "episodeId" UUID NOT NULL, - "text" TEXT NOT NULL, - "isParent" BOOLEAN NOT NULL DEFAULT false, - "parentId" UUID, - "userId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "comments_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "comment_likes" ( - "id" UUID NOT NULL, - "commentId" UUID NOT NULL, - "userLiked" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "comment_likes_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "comment_reports" ( - "id" UUID NOT NULL, - "userReporter" UUID NOT NULL, - "commentReported" UUID NOT NULL, - "isSupervisorReport" BOOLEAN NOT NULL DEFAULT false, - "reason" "ReportReason" NOT NULL, - "status" "ReportStatus" NOT NULL, - "description" VARCHAR(255) NOT NULL, - "approvedBy" UUID, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "comment_reports_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "languages" ( - "id" UUID NOT NULL, - "name" VARCHAR(255) NOT NULL, - "code" VARCHAR(5) NOT NULL, - "countryFlag" VARCHAR(10) NOT NULL, - "fileLocation" TEXT NOT NULL, - "craetedBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "languages_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "email_system_accounts" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "host" VARCHAR(255) NOT NULL, - "port" INTEGER NOT NULL, - "secure" BOOLEAN NOT NULL, - "email" VARCHAR(255) NOT NULL, - "username" VARCHAR(255) NOT NULL, - "password" VARCHAR(255) NOT NULL, - "purpose" "EmailPorpose" NOT NULL, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "email_system_accounts_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "email_system_histories" ( - "id" UUID NOT NULL, - "purpose" "EmailPorpose" NOT NULL, - "fromEmail" TEXT NOT NULL, - "toEmail" TEXT NOT NULL, - "userRelated" UUID NOT NULL, - "title" VARCHAR(255) NOT NULL, - "htmlContent" TEXT NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "email_system_histories_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hero_banner" ( - "id" UUID NOT NULL, - "orderPriority" INTEGER, - "imageUrl" TEXT, - "startDate" TIMESTAMP(3) NOT NULL, - "endDate" TIMESTAMP(3) NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "creatorId" UUID NOT NULL, - "mediaId" UUID NOT NULL, - - CONSTRAINT "hero_banner_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "system_preferences" ( - "id" UUID NOT NULL, - "key" VARCHAR(225) NOT NULL, - "value" VARCHAR(225) NOT NULL, - "description" TEXT NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "system_preferences_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "system_notifications" ( - "id" UUID NOT NULL, - "type" "TypeSystemNotification" NOT NULL, - "componentName" VARCHAR(255), - "popupImage" TEXT, - "titleToast" VARCHAR(255), - "contentToast" TEXT, - "createdBy" UUID NOT NULL, - "deletedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "system_notifications_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "system_logs" ( - "id" UUID NOT NULL, - "title" VARCHAR(255) NOT NULL, - "notes" TEXT NOT NULL, - "relatedUser" UUID, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "system_logs_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "_MediaStudios" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL, - - CONSTRAINT "_MediaStudios_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateTable -CREATE TABLE "_MediaGenres" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL, - - CONSTRAINT "_MediaGenres_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateTable -CREATE TABLE "_UserFavoriteGenres" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL, - - CONSTRAINT "_UserFavoriteGenres_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateTable -CREATE TABLE "_MediaCharacters" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL, - - CONSTRAINT "_MediaCharacters_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateTable -CREATE TABLE "_UserSelectedSharingCollention" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL, - - CONSTRAINT "_UserSelectedSharingCollention_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateIndex -CREATE UNIQUE INDEX "medias_slug_key" ON "medias"("slug"); - --- CreateIndex -CREATE UNIQUE INDEX "medias_malId_key" ON "medias"("malId"); - --- CreateIndex -CREATE INDEX "medias_status_onDraft_deletedAt_idx" ON "medias"("status", "onDraft", "deletedAt"); - --- CreateIndex -CREATE INDEX "medias_mediaType_idx" ON "medias"("mediaType"); - --- CreateIndex -CREATE INDEX "medias_uploadedBy_idx" ON "medias"("uploadedBy"); - --- CreateIndex -CREATE INDEX "medias_createdAt_idx" ON "medias"("createdAt"); - --- CreateIndex -CREATE UNIQUE INDEX "genres_slug_key" ON "genres"("slug"); - --- CreateIndex -CREATE UNIQUE INDEX "genres_malId_key" ON "genres"("malId"); - --- CreateIndex -CREATE UNIQUE INDEX "studios_slug_key" ON "studios"("slug"); - --- CreateIndex -CREATE UNIQUE INDEX "studios_malId_key" ON "studios"("malId"); - --- CreateIndex -CREATE UNIQUE INDEX "characters_malId_key" ON "characters"("malId"); - --- CreateIndex -CREATE UNIQUE INDEX "voice_actors_malId_key" ON "voice_actors"("malId"); - --- CreateIndex -CREATE UNIQUE INDEX "lang_va_char_language_vaId_charId_key" ON "lang_va_char"("language", "vaId", "charId"); - --- CreateIndex -CREATE UNIQUE INDEX "episodes_mediaId_episode_key" ON "episodes"("mediaId", "episode"); - --- CreateIndex -CREATE UNIQUE INDEX "videos_serviceId_videoCode_key" ON "videos"("serviceId", "videoCode"); - --- CreateIndex -CREATE UNIQUE INDEX "video_services_name_key" ON "video_services"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "users_username_key" ON "users"("username"); - --- CreateIndex -CREATE UNIQUE INDEX "users_email_key" ON "users"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "users_providerId_key" ON "users"("providerId"); - --- CreateIndex -CREATE UNIQUE INDEX "user_preferences_userId_key" ON "user_preferences"("userId"); - --- CreateIndex -CREATE UNIQUE INDEX "user_roles_name_key" ON "user_roles"("name"); - --- CreateIndex -CREATE INDEX "user_sessions_userId_isAuthenticated_deletedAt_idx" ON "user_sessions"("userId", "isAuthenticated", "deletedAt"); - --- CreateIndex -CREATE UNIQUE INDEX "collections_slug_ownerId_key" ON "collections"("slug", "ownerId"); - --- CreateIndex -CREATE UNIQUE INDEX "CollectionMedia_collectionId_mediaId_key" ON "CollectionMedia"("collectionId", "mediaId"); - --- CreateIndex -CREATE UNIQUE INDEX "languages_code_key" ON "languages"("code"); - --- CreateIndex -CREATE UNIQUE INDEX "email_system_accounts_name_key" ON "email_system_accounts"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "email_system_accounts_email_key" ON "email_system_accounts"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "email_system_accounts_username_key" ON "email_system_accounts"("username"); - --- CreateIndex -CREATE UNIQUE INDEX "hero_banner_orderPriority_key" ON "hero_banner"("orderPriority"); - --- CreateIndex -CREATE UNIQUE INDEX "system_preferences_key_key" ON "system_preferences"("key"); - --- CreateIndex -CREATE INDEX "_MediaStudios_B_index" ON "_MediaStudios"("B"); - --- CreateIndex -CREATE INDEX "_MediaGenres_B_index" ON "_MediaGenres"("B"); - --- CreateIndex -CREATE INDEX "_UserFavoriteGenres_B_index" ON "_UserFavoriteGenres"("B"); - --- CreateIndex -CREATE INDEX "_MediaCharacters_B_index" ON "_MediaCharacters"("B"); - --- CreateIndex -CREATE INDEX "_UserSelectedSharingCollention_B_index" ON "_UserSelectedSharingCollention"("B"); - --- AddForeignKey -ALTER TABLE "medias" ADD CONSTRAINT "medias_uploadedBy_fkey" FOREIGN KEY ("uploadedBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "media_logs" ADD CONSTRAINT "media_logs_approvedBy_fkey" FOREIGN KEY ("approvedBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "media_logs" ADD CONSTRAINT "media_logs_mediaId_fkey" FOREIGN KEY ("mediaId") REFERENCES "medias"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "media_logs" ADD CONSTRAINT "media_logs_proposedBy_fkey" FOREIGN KEY ("proposedBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "genres" ADD CONSTRAINT "genres_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "studios" ADD CONSTRAINT "studios_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "characters" ADD CONSTRAINT "characters_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "voice_actors" ADD CONSTRAINT "voice_actors_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "lang_va_char" ADD CONSTRAINT "lang_va_char_charId_fkey" FOREIGN KEY ("charId") REFERENCES "characters"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "lang_va_char" ADD CONSTRAINT "lang_va_char_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "lang_va_char" ADD CONSTRAINT "lang_va_char_vaId_fkey" FOREIGN KEY ("vaId") REFERENCES "voice_actors"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "episodes" ADD CONSTRAINT "episodes_mediaId_fkey" FOREIGN KEY ("mediaId") REFERENCES "medias"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "episodes" ADD CONSTRAINT "episodes_uploadedBy_fkey" FOREIGN KEY ("uploadedBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "episode_likes" ADD CONSTRAINT "episode_likes_episodeId_fkey" FOREIGN KEY ("episodeId") REFERENCES "episodes"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "episode_likes" ADD CONSTRAINT "episode_likes_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "user_sessions"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "episode_likes" ADD CONSTRAINT "episode_likes_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "videos" ADD CONSTRAINT "videos_episodeId_fkey" FOREIGN KEY ("episodeId") REFERENCES "episodes"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "videos" ADD CONSTRAINT "videos_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "video_services"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "videos" ADD CONSTRAINT "videos_uploadedBy_fkey" FOREIGN KEY ("uploadedBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "video_services" ADD CONSTRAINT "video_services_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_preferences" ADD CONSTRAINT "user_preferences_langPreference_fkey" FOREIGN KEY ("langPreference") REFERENCES "languages"("code") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_preferences" ADD CONSTRAINT "user_preferences_serviceDefaultId_fkey" FOREIGN KEY ("serviceDefaultId") REFERENCES "video_services"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_preferences" ADD CONSTRAINT "user_preferences_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_role_assignments" ADD CONSTRAINT "user_role_assignments_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "user_roles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_role_assignments" ADD CONSTRAINT "user_role_assignments_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_notifications" ADD CONSTRAINT "user_notifications_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_sessions" ADD CONSTRAINT "user_sessions_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_logs" ADD CONSTRAINT "user_logs_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "user_sessions"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_logs" ADD CONSTRAINT "user_logs_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "collections" ADD CONSTRAINT "collections_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "CollectionMedia" ADD CONSTRAINT "CollectionMedia_collectionId_fkey" FOREIGN KEY ("collectionId") REFERENCES "collections"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "CollectionMedia" ADD CONSTRAINT "CollectionMedia_mediaId_fkey" FOREIGN KEY ("mediaId") REFERENCES "medias"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "watch_histories" ADD CONSTRAINT "watch_histories_id_fkey" FOREIGN KEY ("id") REFERENCES "episodes"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "watch_histories" ADD CONSTRAINT "watch_histories_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "user_sessions"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "watch_histories" ADD CONSTRAINT "watch_histories_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "movie_reviews" ADD CONSTRAINT "movie_reviews_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "movie_reviews" ADD CONSTRAINT "movie_reviews_mediaId_fkey" FOREIGN KEY ("mediaId") REFERENCES "medias"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comments" ADD CONSTRAINT "comments_episodeId_fkey" FOREIGN KEY ("episodeId") REFERENCES "episodes"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comments" ADD CONSTRAINT "comments_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "comments"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comments" ADD CONSTRAINT "comments_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comment_likes" ADD CONSTRAINT "comment_likes_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "comments"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comment_likes" ADD CONSTRAINT "comment_likes_userLiked_fkey" FOREIGN KEY ("userLiked") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comment_reports" ADD CONSTRAINT "comment_reports_approvedBy_fkey" FOREIGN KEY ("approvedBy") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "comment_reports" ADD CONSTRAINT "comment_reports_userReporter_fkey" FOREIGN KEY ("userReporter") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "languages" ADD CONSTRAINT "languages_craetedBy_fkey" FOREIGN KEY ("craetedBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "email_system_accounts" ADD CONSTRAINT "email_system_accounts_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "email_system_histories" ADD CONSTRAINT "email_system_histories_userRelated_fkey" FOREIGN KEY ("userRelated") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hero_banner" ADD CONSTRAINT "hero_banner_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hero_banner" ADD CONSTRAINT "hero_banner_mediaId_fkey" FOREIGN KEY ("mediaId") REFERENCES "medias"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "system_notifications" ADD CONSTRAINT "system_notifications_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "system_logs" ADD CONSTRAINT "system_logs_relatedUser_fkey" FOREIGN KEY ("relatedUser") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_MediaStudios" ADD CONSTRAINT "_MediaStudios_A_fkey" FOREIGN KEY ("A") REFERENCES "medias"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_MediaStudios" ADD CONSTRAINT "_MediaStudios_B_fkey" FOREIGN KEY ("B") REFERENCES "studios"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_MediaGenres" ADD CONSTRAINT "_MediaGenres_A_fkey" FOREIGN KEY ("A") REFERENCES "genres"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_MediaGenres" ADD CONSTRAINT "_MediaGenres_B_fkey" FOREIGN KEY ("B") REFERENCES "medias"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_UserFavoriteGenres" ADD CONSTRAINT "_UserFavoriteGenres_A_fkey" FOREIGN KEY ("A") REFERENCES "genres"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_UserFavoriteGenres" ADD CONSTRAINT "_UserFavoriteGenres_B_fkey" FOREIGN KEY ("B") REFERENCES "user_preferences"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_MediaCharacters" ADD CONSTRAINT "_MediaCharacters_A_fkey" FOREIGN KEY ("A") REFERENCES "characters"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_MediaCharacters" ADD CONSTRAINT "_MediaCharacters_B_fkey" FOREIGN KEY ("B") REFERENCES "medias"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_UserSelectedSharingCollention" ADD CONSTRAINT "_UserSelectedSharingCollention_A_fkey" FOREIGN KEY ("A") REFERENCES "collections"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_UserSelectedSharingCollention" ADD CONSTRAINT "_UserSelectedSharingCollention_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE; - diff --git a/prisma/migrations/20260422050909_change_enum_season/migration.sql b/prisma/migrations/20260422050909_change_enum_season/migration.sql deleted file mode 100644 index 12f68f2..0000000 --- a/prisma/migrations/20260422050909_change_enum_season/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - The values [Winter,Spring,Summer,Fall] on the enum `Season` will be removed. If these variants are still used in the database, this will fail. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "Season_new" AS ENUM ('winter', 'spring', 'summer', 'fall'); -ALTER TABLE "medias" ALTER COLUMN "season" TYPE "Season_new" USING ("season"::text::"Season_new"); -ALTER TYPE "Season" RENAME TO "Season_old"; -ALTER TYPE "Season_new" RENAME TO "Season"; -DROP TYPE "public"."Season_old"; -COMMIT; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml deleted file mode 100644 index 044d57c..0000000 --- a/prisma/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (e.g., Git) -provider = "postgresql" diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 808fddf..0aeca59 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,741 +1,829 @@ +/** + * This is the Prisma schema file for the application. It defines the data models, their relationships, and the database configuration. + * The schema is used by Prisma to generate the database migrations and the Prisma Client for querying the database. + */ + +/** + * ---------------------------------- + * Prisma Schema Configuration + * ---------------------------------- + */ generator client { provider = "prisma-client-js" } - generator dbml { provider = "prisma-dbml-generator" } - datasource db { provider = "postgresql" } -model Media { - id String @id @db.Uuid - title String - titleAlternative Json - slug String @unique - malId Int? @unique - pictureMedium String - pictureLarge String - country Country @default(JP) - score Decimal @default(0.00) @db.Decimal(4, 2) - status String - startAiring DateTime? - endAiring DateTime? - synopsis String - ageRating String - mediaType MediaType - source String? - onDraft Boolean @default(true) - season Season? - yearReleased Int @db.SmallInt - uploadedBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - inCollections CollectionMedia[] @relation("CollectionMedia") - episodes Episode[] @relation("MediaEpisodes") - bannerPromotion HeroBanner[] @relation("MediaBannerPromotion") - logs MediaLog[] @relation("MediaLogs") - uploader User @relation("UserUploadedMedias", fields: [uploadedBy], references: [id]) - reviews MediaReview[] @relation("MediaReviews") - characters Character[] @relation("MediaCharacters") - genres Genre[] @relation("MediaGenres") - studios Studio[] @relation("MediaStudios") - @@index([status, onDraft, deletedAt]) - @@index([mediaType]) - @@index([uploadedBy]) - @@index([createdAt]) - @@map("medias") + +/** + * ---------------------------------- + * Enum Definitions + * ---------------------------------- + */ +enum user_role { + user + contributor + curator + admin } -model MediaLog { - id String @id @db.Uuid - status MediaOperation - approval Boolean @default(false) - proposedBy String @db.Uuid - approvedBy String @db.Uuid - mediaId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - approver User @relation("UserApprovedMedias", fields: [approvedBy], references: [id]) - media Media @relation("MediaLogs", fields: [mediaId], references: [id]) - proposer User @relation("UserProposedMedias", fields: [proposedBy], references: [id]) - - @@map("media_logs") +enum user_sex { + male + female } -model Genre { - id String @id @db.Uuid - name String @db.VarChar(255) - slug String @unique @db.VarChar(255) - malId Int @unique - malUrl String @db.VarChar(255) - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creator User @relation("UserCreatedGenres", fields: [createdBy], references: [id]) - medias Media[] @relation("MediaGenres") - user_favourite_genres UserPreference[] @relation("UserFavoriteGenres") - - @@map("genres") +enum auth_provider { + google + github } -model Studio { - id String @id @db.Uuid - name String @db.VarChar(255) - slug String @unique @db.VarChar(255) - linkAbout String - malId Int @unique - logoUrl String? - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creator User @relation("UserCreatedStudios", fields: [createdBy], references: [id]) - medias Media[] @relation("MediaStudios") - - @@map("studios") +enum device_type { + mobile + tablet + desktop + unknown } -model Character { - id String @id @db.Uuid - malId Int @unique - name String - role CharacterRole - favorites Int @default(0) - imageUrl String? - smallImageUrl String? - creatorId String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - createdBy User @relation("UserCreatedCharacters", fields: [creatorId], references: [id]) - voice_actors LangVAChar[] @relation("CharVALanguage") - medias Media[] @relation("MediaCharacters") - - @@map("characters") +enum user_preference_state { + exclude + include } -model VoiceActor { - id String @id @db.Uuid - malId Int @unique - name String - birthday DateTime? - description String? - aboutUrl String? - imageUrl String? - websiteUrl String? - creatorId String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - characters LangVAChar[] @relation("VACharLanguage") - createdBy User @relation("UserCreatedVoiceActors", fields: [creatorId], references: [id]) - - @@map("voice_actors") -} - -model LangVAChar { - id String @id @db.Uuid - language String - vaId String @db.Uuid - charId String @db.Uuid - creatorId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - character Character @relation("CharVALanguage", fields: [charId], references: [id]) - createdBy User @relation("UserCreatedLangVAChar", fields: [creatorId], references: [id]) - voiceActor VoiceActor @relation("VACharLanguage", fields: [vaId], references: [id]) - - @@unique([language, vaId, charId]) - @@map("lang_va_char") -} - -model Episode { - id String @id @db.Uuid - mediaId String @db.Uuid - episode Int - name String @db.VarChar(255) - score Decimal @default(0.00) @db.Decimal(4, 2) - pictureThumbnail String? - viewed BigInt @default(0) - likes BigInt @default(0) - dislikes BigInt @default(0) - pendingUpload Boolean @default(true) - uploadedBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - comments Comment[] @relation("EpisodeComments") - user_likes EpisodeLike[] @relation("EpisodeLikes") - media Media @relation("MediaEpisodes", fields: [mediaId], references: [id]) - uploader User @relation("UserEpisodes", fields: [uploadedBy], references: [id]) - videos Video[] @relation("EpisodeVideos") - user_histories WatchHistory? @relation("EpisodeWatchHistories") - - @@unique([mediaId, episode]) - @@map("episodes") -} - -model EpisodeLike { - id String @id @db.Uuid - userId String @db.Uuid - sessionId String @db.Uuid - episodeId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - episode Episode @relation("EpisodeLikes", fields: [episodeId], references: [id]) - session UserSession @relation("SessionEpisodeLikes", fields: [sessionId], references: [id]) - user User @relation("UserEpisodeLikes", fields: [userId], references: [id]) - - @@map("episode_likes") -} - -model Video { - id String @id @db.Uuid - episodeId String @db.Uuid - serviceId String @db.Uuid - videoCode String @db.VarChar(255) - thumbnailCode String? - pendingUpload Boolean @default(true) - uploadedBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - episode Episode @relation("EpisodeVideos", fields: [episodeId], references: [id]) - service VideoService @relation("VideoServices", fields: [serviceId], references: [id]) - uploader User @relation("UserVideos", fields: [uploadedBy], references: [id]) - - @@unique([serviceId, videoCode]) - @@map("videos") -} - -model VideoService { - id String @id @db.Uuid - name String @unique @db.VarChar(255) - domain String @db.VarChar(255) - logo String? - hexColor String @db.VarChar(10) - endpointVideo String - endpointThumbnail String? - endpointDownload String? - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - user_preferences UserPreference[] @relation("UserServiceDefault") - creator User @relation("UserVideoServices", fields: [createdBy], references: [id]) - videos Video[] @relation("VideoServices") - - @@map("video_services") -} - -model User { - id String @id @db.Uuid - name String @db.VarChar(255) - username String @unique @db.VarChar(255) - email String @unique - password String - birthDate DateTime? @db.Date - gender UserGender? - phoneCC Int? - phoneNumber Int? - bioProfile String? - avatar String? - commentBackground String? - provider String? @db.VarChar(255) - providerId String? @unique @db.VarChar(255) - providerToken String? - providerPayload Json? @db.Json - verifiedAt DateTime? - disabledAt DateTime? - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - characters Character[] @relation("UserCreatedCharacters") - collections Collection[] @relation("UserCollections") - liked_comments CommentLike[] @relation("UserCommentLikes") - approved_comments CommentReport[] @relation("ApprovedReportComments") - reported_comments CommentReport[] @relation("UserReportComments") - comments Comment[] @relation("UserComments") - user_create_email EmailSystemAccount[] @relation("UserCreateSystemAccount") - user_emails EmailSystemHistory[] @relation("UserEmails") - episode_likes EpisodeLike[] @relation("UserEpisodeLikes") - episodes Episode[] @relation("UserEpisodes") - genres Genre[] @relation("UserCreatedGenres") - user_hero_banner HeroBanner[] @relation("UserHeroBanner") - lang_va_char LangVAChar[] @relation("UserCreatedLangVAChar") - create_languages Language[] @relation("UserCreateLanguages") - media_approveds MediaLog[] @relation("UserApprovedMedias") - media_proposeds MediaLog[] @relation("UserProposedMedias") - medias Media[] @relation("UserUploadedMedias") - media_reviews MediaReview[] @relation("UserMediaReviews") - studios Studio[] @relation("UserCreatedStudios") - sys_logs SystemLog[] @relation("UserSystemLogs") - sys_notifications SystemNotification[] @relation("UserCreatorSystemNotifications") - logs UserLog[] @relation("UserLogs") - notifications UserNotification[] @relation("UserNotifications") - preference UserPreference? - assignedRoles UserRoleAssignment[] - create_roles UserRole[] @relation("UserCreateRoles") - sessions UserSession[] @relation("UserSession") - video_services VideoService[] @relation("UserVideoServices") - videos Video[] @relation("UserVideos") - voice_actor VoiceActor[] @relation("UserCreatedVoiceActors") - watch_histories WatchHistory[] @relation("UserWatchHistories") - allowed_collections Collection[] @relation("UserSelectedSharingCollention") - - @@map("users") -} - -model UserPreference { - id String @id @db.Uuid - userId String @unique @db.Uuid - langPreference String? - adultFiltering AdultFiltering @default(hide) - adultAlert AdultAlert @default(show) - videoQuality VideoQuality @default(Q1080) - serviceDefaultId String? @db.Uuid - hideContries Country[] - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - lang Language? @relation("UserPreferenceLang", fields: [langPreference], references: [code]) - serviceDefault VideoService? @relation("UserServiceDefault", fields: [serviceDefaultId], references: [id]) - user User @relation(fields: [userId], references: [id]) - favoriteGenres Genre[] @relation("UserFavoriteGenres") - - @@map("user_preferences") -} - -model UserRole { - id String @id @db.Uuid - name String @unique @db.VarChar(255) - description String? - primaryColor String? @db.VarChar(10) - secondaryColor String? @db.VarChar(10) - pictureImage String? - badgeImage String? - isSuperadmin Boolean @default(false) - canEditMedia Boolean @default(false) - canManageMedia Boolean @default(false) - canEditEpisodes Boolean @default(false) - canManageEpisodes Boolean @default(false) - canEditComment Boolean @default(false) - canManageComment Boolean @default(false) - canEditUser Boolean @default(false) - canManageUser Boolean @default(false) - canEditSystem Boolean @default(false) - canManageSystem Boolean @default(false) - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - assignedUser UserRoleAssignment[] - creator User @relation("UserCreateRoles", fields: [createdBy], references: [id]) - - @@map("user_roles") -} - -model UserRoleAssignment { - userId String @db.Uuid - roleId String @db.Uuid - assignmentAt DateTime @default(now()) - role UserRole @relation(fields: [roleId], references: [id]) - user User @relation(fields: [userId], references: [id]) - - @@id([userId, roleId]) - @@map("user_role_assignments") -} - -model UserNotification { - id String @id @db.Uuid - title String @db.VarChar(255) - content String - picture String - state UserNotificationState - ctaLink String - userId String @db.Uuid - isReaded Boolean @default(false) - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - user User @relation("UserNotifications", fields: [userId], references: [id]) - - @@map("user_notifications") -} - -model UserSession { - id String @id @db.Uuid - isAuthenticated Boolean @default(false) - userId String @db.Uuid - deviceType String @db.VarChar(255) - deviceOs String @db.VarChar(255) - deviceIp String @db.VarChar(255) - browser String @db.VarChar(255) - isOnline Boolean @default(false) - lastOnline DateTime @default(now()) - validUntil DateTime - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - episode_likes EpisodeLike[] @relation("SessionEpisodeLikes") - logs UserLog[] @relation("UserSessionLogs") - user User @relation("UserSession", fields: [userId], references: [id]) - watch_histories WatchHistory[] @relation("SessionWatchHistories") - - @@index([userId, isAuthenticated, deletedAt]) - @@map("user_sessions") -} - -model UserLog { - id String @id @db.Uuid - title String @db.VarChar(255) - notes String - userId String @db.Uuid - sessionId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - session UserSession @relation("UserSessionLogs", fields: [sessionId], references: [id]) - user User @relation("UserLogs", fields: [userId], references: [id]) - - @@map("user_logs") -} - -model Collection { - id String @id @db.Uuid - name String @db.VarChar(115) - ownerId String @db.Uuid - accessStatus AccessStatus @default(private) - password String? @db.VarChar(255) - accessScope AccessScope @default(viewer) - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - slug String @db.VarChar(115) - media_saved CollectionMedia[] @relation("CollectionMedia") - owner User @relation("UserCollections", fields: [ownerId], references: [id]) - usersAllowed User[] @relation("UserSelectedSharingCollention") - - @@unique([slug, ownerId]) - @@map("collections") -} - -model CollectionMedia { - id String @id @db.Uuid - collectionId String @db.Uuid - mediaId String @db.Uuid - savedAt DateTime @default(now()) - collection Collection @relation("CollectionMedia", fields: [collectionId], references: [id]) - media Media @relation("CollectionMedia", fields: [mediaId], references: [id]) - - @@unique([collectionId, mediaId]) -} - -model WatchHistory { - id String @id @db.Uuid - episodeId String @db.Uuid - userId String @db.Uuid - sessionId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - episode Episode @relation("EpisodeWatchHistories", fields: [id], references: [id]) - session UserSession @relation("SessionWatchHistories", fields: [sessionId], references: [id]) - user User @relation("UserWatchHistories", fields: [userId], references: [id]) - - @@map("watch_histories") -} - -model MediaReview { - id String @id @db.Uuid - mediaId String @db.Uuid - rating Int - title String @db.VarChar(255) - text String - reaction MediaReviewReaction - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creator User @relation("UserMediaReviews", fields: [createdBy], references: [id]) - media Media @relation("MediaReviews", fields: [mediaId], references: [id]) - - @@map("movie_reviews") -} - -model Comment { - id String @id @db.Uuid - episodeId String @db.Uuid - text String - isParent Boolean @default(false) - parentId String? @db.Uuid - userId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - likes CommentLike[] @relation("CommentLikes") - episode Episode @relation("EpisodeComments", fields: [episodeId], references: [id]) - parent Comment? @relation("ParentReplyComments", fields: [parentId], references: [id]) - replies Comment[] @relation("ParentReplyComments") - user User @relation("UserComments", fields: [userId], references: [id]) - - @@map("comments") -} - -model CommentLike { - id String @id @db.Uuid - commentId String @db.Uuid - userLiked String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - comment Comment @relation("CommentLikes", fields: [commentId], references: [id]) - user User @relation("UserCommentLikes", fields: [userLiked], references: [id]) - - @@map("comment_likes") -} - -model CommentReport { - id String @id @db.Uuid - userReporter String @db.Uuid - commentReported String @db.Uuid - isSupervisorReport Boolean @default(false) - reason ReportReason - status ReportStatus - description String @db.VarChar(255) - approvedBy String? @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - approver User? @relation("ApprovedReportComments", fields: [approvedBy], references: [id]) - reporter User @relation("UserReportComments", fields: [userReporter], references: [id]) - - @@map("comment_reports") -} - -model Language { - id String @id @db.Uuid - name String @db.VarChar(255) - code String @unique @db.VarChar(5) - countryFlag String @db.VarChar(10) - fileLocation String - craetedBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creator User @relation("UserCreateLanguages", fields: [craetedBy], references: [id]) - user_used UserPreference[] @relation("UserPreferenceLang") - - @@map("languages") -} - -model EmailSystemAccount { - id String @id @db.Uuid - name String @unique - host String @db.VarChar(255) - port Int - secure Boolean - email String @unique @db.VarChar(255) - username String @unique @db.VarChar(255) - password String @db.VarChar(255) - purpose EmailPorpose - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creator User @relation("UserCreateSystemAccount", fields: [createdBy], references: [id]) - - @@map("email_system_accounts") -} - -model EmailSystemHistory { - id String @id @db.Uuid - purpose EmailPorpose - fromEmail String - toEmail String - userRelated String @db.Uuid - title String @db.VarChar(255) - htmlContent String - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - user User @relation("UserEmails", fields: [userRelated], references: [id]) - - @@map("email_system_histories") -} - -model HeroBanner { - id String @id @db.Uuid - orderPriority Int? @unique - imageUrl String? - startDate DateTime - endDate DateTime - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creatorId String @db.Uuid - mediaId String @db.Uuid - createdBy User @relation("UserHeroBanner", fields: [creatorId], references: [id]) - media Media @relation("MediaBannerPromotion", fields: [mediaId], references: [id]) - - @@map("hero_banner") -} - -model SystemPreference { - id String @id @db.Uuid - key String @unique @db.VarChar(225) - value String @db.VarChar(225) - description String - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - - @@map("system_preferences") -} - -model SystemNotification { - id String @id @db.Uuid - type TypeSystemNotification - componentName String? @db.VarChar(255) - popupImage String? - titleToast String? @db.VarChar(255) - contentToast String? - createdBy String @db.Uuid - deletedAt DateTime? - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - creator User @relation("UserCreatorSystemNotifications", fields: [createdBy], references: [id]) - - @@map("system_notifications") -} - -model SystemLog { - id String @id @db.Uuid - title String @db.VarChar(255) - notes String - relatedUser String? @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - user User? @relation("UserSystemLogs", fields: [relatedUser], references: [id]) - - @@map("system_logs") -} - -enum MediaType { - TV - ONA - OVA - Movie - Special - Music -} - -enum Country { - JP @map("Japanese") - EN @map("English") - ID @map("Indonesia") - KR @map("Korea") -} - -enum Season { +enum media_season { winter spring summer fall } -enum CharacterRole { - Main - Supporting +enum character_role { + main + supporting + background } -enum MediaOperation { - create - update - delete -} - -enum UserGender { - male - female -} - -enum AdultFiltering { - hide - show - explicit -} - -enum AdultAlert { - hide - show -} - -enum VideoQuality { - Q2160 - Q1440 - Q1080 - Q720 - Q480 - Q360 - Q240 - Q144 -} - -enum UserNotificationState { - info - warning - danger -} - -enum ReportStatus { +enum status_submission { pending - resolved + approved rejected } -enum ReportReason { - sexualize - violent - explicit - hateful - political - racist - spam - other +enum like_type { + like + dislike } -enum AccessStatus { - private - selected - protected +enum audit_action { + delete + restore + edit + flag +} + +enum privacy_level { public + unlisted + private } -enum AccessScope { +enum collection_access_level { + owner + moderator + contributor viewer - editor } -enum MediaReviewReaction { - angry - sad - awesome - happy - sleepy - annoyed - disgusting - disappointed + + +/** + * ---------------------------------- + * Model for User and related entities + * ---------------------------------- + */ +model User { + id String @id @db.Uuid @default(uuid(7)) + email String @unique + password String? @db.VarChar(255) + username String @unique @db.VarChar(28) + fullname String @db.VarChar(32) + avatar String? @db.VarChar(255) + bio String? @db.Text + datebirth DateTime? @db.Date + role user_role @default(user) + sex user_sex? + phone_number String? @db.VarChar(20) + country Country? @relation(fields: [countryId], references: [id], name: "UserCountry") + auth_provider String? @db.VarChar(64) + provider_token String? @db.VarChar(255) + address UserAddress? + preferences UserPreference? + created_at DateTime @default(now()) @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + deleted_at DateTime? @db.Timestamptz() + + countryId String? @db.Uuid + oauth_accounts UserOauthAccounts[] + sessions UserSession[] + followers UserFollow[] @relation("UserFollowFollowing") + following UserFollow[] @relation("UserFollowFollower") + provisioned_as_admin ProvisionedUser[] @relation("ProvisionedUserAdmin") + provisioned_as_user ProvisionedUser[] @relation("ProvisionedUserUser") + created_producers Producer[] + submitted_media MediaSubmission[] @relation("MediaSubmissionSubmitter") + reviewed_media MediaSubmission[] @relation("MediaSubmissionReviewer") + updated_media Media[] @relation("MediaUpdater") + deleted_media Media[] @relation("MediaDeleter") + created_episodes Episode[] + submitted_videos VideoSubmission[] @relation("VideoSubmissionSubmitter") + reviewed_videos VideoSubmission[] @relation("VideoSubmissionReviewer") + submitted_video_services VideoServiceSubmission[] @relation("VideoServiceSubmissionSubmitter") + reviewed_video_services VideoServiceSubmission[] @relation("VideoServiceSubmissionReviewer") + comments Comment[] + comment_likes CommentLike[] + comment_audit_logs CommentAuditLog[] + comment_reports CommentReport[] + home_media_banners HomeMediaBanner[] + watch_histories UserWatchHistory[] + saved_collections CollectionMember[] @relation("CollectionMemberUser") + invited_collections CollectionMember[] @relation("CollectionMemberInviter") + contributed_collections MediaCollection[] @relation("MediaCollectionAdder") + @@index([email]) + @@index([username]) + @@map("users") } -enum EmailPorpose { - forgot_password - account_activation - account_notification - subscribtion +model UserAddress { + user_id String @id @db.Uuid + address String @db.VarChar(255) + district String @db.VarChar(100) + city String @db.VarChar(100) + province String @db.VarChar(100) + postal_code String @db.VarChar(20) + coordinate String? @db.VarChar(50) + updated_at DateTime @updatedAt @db.Timestamptz() + + user User @relation(fields: [user_id], references: [id]) + @@map("user_addresses") } -enum TypeSystemNotification { - component - popup - toast +model UserOauthAccounts { + id String @id @db.Uuid @default(uuid(7)) + user User @relation(fields: [user_id], references: [id]) + provider_name auth_provider + provider_sub String? @db.VarChar(255) + provider_email String? @db.VarChar(255) + provider_token String? @db.VarChar(255) + refresh_token String? @db.VarChar(255) + expires_at DateTime? @db.Timestamptz() + last_login DateTime @default(now()) @db.Timestamptz() + created_at DateTime @default(now()) @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + + user_id String @db.Uuid + @@map("user_oauth_accounts") } + +model UserSession { + id String @id @db.Uuid @default(uuid(7)) + user User @relation(fields: [user_id], references: [id]) + device_type device_type + os_type String? @db.VarChar(50) + os_version String? @db.VarChar(50) + browser_name String? @db.VarChar(50) + browser_version String? @db.VarChar(50) + ip_login String? @db.Inet() + login_at DateTime @default(now()) @db.Timestamptz() + logout_at DateTime? @db.Timestamptz() + + user_id String @db.Uuid + @@map("user_sessions") +} + +model UserPreference { + user User @relation(fields: [user_id], references: [id]) + char_as_partner Character @relation(fields: [char_as_partner_id], references: [id]) + comment_picture String? @db.VarChar(255) + enable_watch_history Boolean @default(true) + enable_search_history Boolean @default(false) + is_private_account Boolean @default(false) + can_message_me Boolean @default(true) + publish_birthday Boolean @default(false) + publish_email Boolean @default(false) + publish_phone_number Boolean @default(false) + publish_country Boolean @default(false) + publish_partner Boolean @default(true) + subscribe_to_newsletter Boolean @default(true) + enable_security_alerts Boolean @default(true) + genre_preferences UserGenrePreference[] + rating_preferences UserRatingPreference[] + country_preferences UserCountryPreference[] + + user_id String @id @db.Uuid + char_as_partner_id String @db.Uuid + @@map("user_preferences") +} + +model UserGenrePreference { + user UserPreference @relation(fields: [user_id], references: [user_id]) + genre Genre @relation(fields: [genre_id], references: [id]) + state user_preference_state + + user_id String @db.Uuid + genre_id String @db.Uuid + @@id([user_id, genre_id]) + @@map("user_genre_preferences") +} + +model UserRatingPreference { + user UserPreference @relation(fields: [user_id], references: [user_id]) + rating MediaAgeRating @relation(fields: [rating_id], references: [id]) + state user_preference_state + + user_id String @db.Uuid + rating_id String @db.Uuid + @@id([user_id, rating_id]) + @@map("user_rating_preferences") +} + +model UserCountryPreference { + user UserPreference @relation(fields: [user_id], references: [user_id]) + country Country @relation(fields: [country_id], references: [id]) + state user_preference_state + + user_id String @db.Uuid + country_id String @db.Uuid + @@id([user_id, country_id]) + @@map("user_country_preferences") +} + +model UserFollow { + follower User @relation("UserFollowFollower", fields: [follower_id], references: [id]) + following User @relation("UserFollowFollowing", fields: [following_id], references: [id]) + created_at DateTime @default(now()) @db.Timestamptz() + + follower_id String @db.Uuid + following_id String @db.Uuid + @@id([follower_id, following_id]) + @@map("user_follows") +} + +model UserWatchHistory { + user User @relation(fields: [user_id], references: [id]) + episode Episode @relation(fields: [episode_id], references: [id]) + updated_at DateTime @updatedAt @db.Timestamptz() + + user_id String @db.Uuid + episode_id String @db.Uuid + @@id([user_id, episode_id]) + @@map("user_watch_histories") +} + +model Collection { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(64) + code String? @db.VarChar(12) + cover_url String? @db.VarChar(255) + privacy privacy_level @default(private) + created_at DateTime @default(now()) @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + + saved_media MediaCollection[] + members CollectionMember[] + @@map("collections") +} + +model CollectionMember { + collection Collection @relation(fields: [collection_id], references: [id]) + user User @relation(fields: [user_id], references: [id], name: "CollectionMemberUser") + access_level collection_access_level + invited_by User? @relation(fields: [invited_by_id], references: [id], name: "CollectionMemberInviter") + invited_at DateTime? @db.Timestamptz() + + collection_id String @db.Uuid + user_id String @db.Uuid + invited_by_id String? @db.Uuid + @@id([collection_id, user_id]) + @@map("collection_members") +} + + + +/** + * ---------------------------------- + * Model for Media and related entities + * ---------------------------------- + */ +model Media { + id String @id @db.Uuid @default(uuid(7)) + mal_id Int @unique + title String @db.VarChar(255) + title_secondary String? @db.VarChar(255) + title_original String? @db.VarChar(255) + title_synonyms String[] @db.VarChar(255) + trailer MediaTrailer? + synopsis String? @db.Text + small_image_url String? @db.VarChar(255) + medium_image_url String @db.VarChar(255) + large_image_url String? @db.VarChar(255) + type MediaType @relation(fields: [type_id], references: [id]) + source MediaSource? @relation(fields: [source_id], references: [id]) + status MediaStatus? @relation(fields: [status_id], references: [id]) + airing Boolean + start_airing DateTime? @db.Date + end_airing DateTime? @db.Date + age_rating MediaAgeRating? @relation(fields: [age_rating_id], references: [id]) + score Decimal? @db.Decimal(2, 2) + score_total Int @default(0) + score_count Int @default(0) + background String? @db.Text + season media_season + year Int? @db.SmallInt + country Country? @relation(fields: [country_id], references: [id]) + broadcast_day String? @db.VarChar(20) + producers MediaProducer[] + licensors MediaLicensor[] + studios MediaStudio[] + genres MediaGenre[] + explicit_genres MediaExplicitGenre[] + themes MediaTheme[] + demographics MediaDemographic[] + relations MediaRelation[] @relation("MediaRelationMedia") + external_links MediaExternalLink[] + characters MediaCharacter[] + submissions MediaSubmission? + created_at DateTime @default(now()) @db.Timestamptz() + updated_by User? @relation(fields: [updated_by_id], references: [id], name: "MediaUpdater") + updated_at DateTime @updatedAt @db.Timestamptz() + deleted_by User? @relation(fields: [deleted_by_id], references: [id], name: "MediaDeleter") + deleted_at DateTime? @db.Timestamptz() + + type_id String @db.Uuid + source_id String @db.Uuid + status_id String @db.Uuid + age_rating_id String? @db.Uuid + country_id String? @db.Uuid + related_media MediaRelation[] @relation("MediaRelationRelatedMedia") + approver_id String? @db.Uuid + created_by_id String? @db.Uuid + updated_by_id String? @db.Uuid + deleted_by_id String? @db.Uuid + home_media_banners HomeMediaBanner[] + saved_to_collections MediaCollection[] + @@map("medias") +} + +model MediaSubmission { + id String @id @db.Uuid @default(uuid(7)) + media Media @relation(fields: [media_id], references: [id]) + submitter User @relation(fields: [submitter_id], references: [id], name: "MediaSubmissionSubmitter") + status status_submission @default(pending) + reviewer User? @relation(fields: [reviewer_id], references: [id], name: "MediaSubmissionReviewer") + reviewed_at DateTime? @db.Timestamptz() + reason String? @db.Text + created_at DateTime @default(now()) @db.Timestamptz() + + media_id String @db.Uuid @unique + submitter_id String @db.Uuid + reviewer_id String? @db.Uuid + @@map("media_submissions") +} + +model MediaCollection { + media Media @relation(fields: [media_id], references: [id]) + collection Collection @relation(fields: [collection_id], references: [id]) + added_by User @relation(fields: [added_by_id], references: [id], name: "MediaCollectionAdder") + added_at DateTime @default(now()) @db.Timestamptz() + + media_id String @db.Uuid + collection_id String @db.Uuid + added_by_id String @db.Uuid + @@id([media_id, collection_id]) + @@map("media_collections") +} + +model MediaTrailer { + media_id String @id @db.Uuid + url String? @db.VarChar(255) + embed_url String? @db.VarChar(255) + small_image_url String? @db.VarChar(255) + large_image_url String? @db.VarChar(255) + maximum_image_url String? @db.VarChar(255) + + media Media @relation(fields: [media_id], references: [id]) + @@map("media_trailers") +} + +model MediaType { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(100) @unique + + Media Media[] + @@map("media_types") +} + +model MediaSource { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(100) @unique + + media Media[] + @@map("media_sources") +} + +model MediaStatus { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(100) @unique + + media Media[] + @@map("media_statuses") +} + +model MediaAgeRating { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(100) @unique + min_age Int @db.SmallInt + + media Media[] + user_rating_preferences UserRatingPreference[] + @@map("media_age_ratings") +} + +model MediaProducer { + media Media @relation(fields: [media_id], references: [id]) + producer Producer @relation(fields: [producer_id], references: [id]) + + media_id String @db.Uuid + producer_id String @db.Uuid + @@id([media_id, producer_id]) + @@map("media_producers") +} + +model MediaLicensor { + media Media @relation(fields: [media_id], references: [id]) + licensor Producer @relation(fields: [licensor_id], references: [id]) + + media_id String @db.Uuid + licensor_id String @db.Uuid + @@id([media_id, licensor_id]) + @@map("media_licensors") +} + +model MediaStudio { + media Media @relation(fields: [media_id], references: [id]) + studio Producer @relation(fields: [studio_id], references: [id]) + + media_id String @db.Uuid + studio_id String @db.Uuid + @@id([media_id, studio_id]) + @@map("media_studios") +} + +model Producer { + id String @id @db.Uuid @default(uuid(7)) + mal_id Int @unique + type String @db.VarChar(24) + name String @db.VarChar(255) + url String? @db.VarChar(255) + created_by User @relation(fields: [created_by_id], references: [id]) + created_at DateTime @default(now()) @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + deleted_at DateTime? @db.Timestamptz() + created_by_id String @db.Uuid + + media_producers MediaProducer[] + media_licensors MediaLicensor[] + media_studios MediaStudio[] + @@map("producers") +} + +model MediaGenre { + media Media @relation(fields: [media_id], references: [id]) + genre Genre @relation(fields: [genre_id], references: [id]) + + media_id String @db.Uuid + genre_id String @db.Uuid + @@id([media_id, genre_id]) + @@map("media_genres") +} + +model MediaExplicitGenre { + media Media @relation(fields: [media_id], references: [id]) + genre Genre @relation(fields: [genre_id], references: [id]) + + media_id String @db.Uuid + genre_id String @db.Uuid + @@id([media_id, genre_id]) + @@map("media_explicit_genres") +} + +model MediaTheme { + media Media @relation(fields: [media_id], references: [id]) + theme Genre @relation(fields: [genre_id], references: [id]) + + media_id String @db.Uuid + genre_id String @db.Uuid + @@id([media_id, genre_id]) + @@map("media_themes") +} + +model MediaDemographic { + media Media @relation(fields: [media_id], references: [id]) + demographic Genre @relation(fields: [demographic_id], references: [id]) + + media_id String @db.Uuid + demographic_id String @db.Uuid + @@id([media_id, demographic_id]) + @@map("media_demographics") +} + +model Genre { + id String @id @db.Uuid @default(uuid(7)) + mal_id Int @unique @db.SmallInt + name String @db.VarChar(100) + slug String @db.VarChar(115) + thumbnail_url String? @db.VarChar(255) + + media_genres MediaGenre[] + media_explicit_genres MediaExplicitGenre[] + media_themes MediaTheme[] + media_demographics MediaDemographic[] + user_genre_preferences UserGenrePreference[] + @@map("genres") +} + +model MediaRelation { + media Media @relation(fields: [media_id], references: [id], name: "MediaRelationMedia") + related_media Media @relation(fields: [related_media_id], references: [id], name: "MediaRelationRelatedMedia") + relation_type String @db.VarChar(50) + + media_id String @db.Uuid + related_media_id String @db.Uuid + @@id([media_id, related_media_id]) + @@map("media_relations") +} + +model MediaExternalLink { + id String @id @db.Uuid @default(uuid(7)) + media Media @relation(fields: [media_id], references: [id]) + url String @db.VarChar(255) + site_name String? @db.VarChar(100) + + media_id String @db.Uuid + @@map("media_external_links") +} + +model MediaCharacter { + id String @id @db.Uuid @default(uuid(7)) + media Media @relation(fields: [media_id], references: [id]) + character Character @relation(fields: [character_id], references: [id]) + voice_actors VoiceActor[] + role character_role + + media_id String @db.Uuid + character_id String @db.Uuid + @@map("media_characters") +} + +model Character { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(255) + image String? @db.VarChar(255) + small_image String? @db.VarChar(255) + mal_id Int? @unique + fanpage_url String? @db.VarChar(255) + liked Int @default(0) + deleted_at DateTime? @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + created_at DateTime @default(now()) @db.Timestamptz() + + partnered_user UserPreference[] + media_characters MediaCharacter[] + @@map("characters") +} + +model VoiceActor { + id String @id @db.Uuid @default(uuid(7)) + media_character_id String @db.Uuid + language String @db.VarChar(115) + actor_staff Staff @relation(fields: [staff_id], references: [id]) + + staff_id String @db.Uuid + media_character MediaCharacter @relation(fields: [media_character_id], references: [id]) + @@map("voice_actors") +} + +model Staff { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(255) + image String? @db.VarChar(255) + mal_id Int? @unique + deleted_at DateTime? @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + created_at DateTime @default(now()) @db.Timestamptz() + + voice_actors VoiceActor[] + @@map("staff") +} + +model Episode { + id String @id @db.Uuid @default(uuid(7)) + media_id String @db.Uuid + episode Int @db.SmallInt + mal_url String? @db.VarChar(255) + forum_url String? @db.VarChar(255) + title String @db.VarChar(155) + title_origin String? @db.VarChar(155) + title_romanji String? @db.VarChar(155) + aired_at DateTime? @db.Date + filler Boolean + recap Boolean + total_score Int @default(0) + score_count Int @default(0) + deleted_at DateTime? @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + created_at DateTime @default(now()) @db.Timestamptz() + created_by User @relation(fields: [created_by_id], references: [id]) + + videos Video[] + created_by_id String @db.Uuid + comments Comment[] + watch_histories UserWatchHistory[] + @@index([media_id, episode]) + @@map("episodes") +} + +model Video { + id String @id @db.Uuid @default(uuid(7)) + service VideoService[] + Episode Episode @relation(fields: [episode_id], references: [id]) + video_code String @db.VarChar(255) + short_code String? @db.VarChar(255) + thumbnail_code String? @db.VarChar(255) + download_code String? @db.VarChar(255) + created_at DateTime @default(now()) @db.Timestamptz() + deleted_at DateTime? @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + + episode_id String @db.Uuid + created_by_id String @db.Uuid + video_submission VideoSubmission? + @@map("videos") +} + +model VideoSubmission { + video_id String @id @db.Uuid + created_by User @relation(fields: [created_by_id], references: [id], name: "VideoSubmissionSubmitter") + reviewer User? @relation(fields: [reviewer_id], references: [id], name: "VideoSubmissionReviewer") + status status_submission @default(pending) + reviewed_at DateTime? @db.Timestamptz() + reason String? @db.Text + created_at DateTime @default(now()) @db.Timestamptz() + + created_by_id String @db.Uuid + reviewer_id String? @db.Uuid + video Video @relation(fields: [video_id], references: [id]) + @@map("video_submissions") +} + +model VideoService { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(155) + resolution Int @db.SmallInt + domain String @db.VarChar(255) + image_url String? @db.VarChar(255) + hex_color String? @db.VarChar(10) + endpoint_video String @db.VarChar(255) + endpoint_short String? @db.VarChar(255) + endpoint_image String? @db.VarChar(255) + endpoint_download String? @db.VarChar(255) + deleted_at DateTime? @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + created_at DateTime @default(now()) @db.Timestamptz() + + videos Video[] + video_service_submissions VideoServiceSubmission? + @@unique([name, resolution]) + @@map("video_services") +} + +model VideoServiceSubmission { + video_service_id String @id @db.Uuid + created_by User @relation(fields: [created_by_id], references: [id], name: "VideoServiceSubmissionSubmitter") + status status_submission @default(pending) + reviewer User? @relation(fields: [reviewer_id], references: [id], name: "VideoServiceSubmissionReviewer") + reviewed_at DateTime? @db.Timestamptz() + reason String? @db.Text + created_at DateTime @default(now()) @db.Timestamptz() + + video_service VideoService @relation(fields: [video_service_id], references: [id]) + created_by_id String @db.Uuid + reviewer_id String? @db.Uuid + @@map("video_service_submissions") +} + +model Comment { + id String @id @db.Uuid @default(uuid(7)) + user User @relation(fields: [user_id], references: [id]) + episode Episode @relation(fields: [episode_id], references: [id]) + content String @db.Text + created_at DateTime @default(now()) @db.Timestamptz() + updated_at DateTime @updatedAt @db.Timestamptz() + deleted_at DateTime? @db.Timestamptz() + + user_id String @db.Uuid + episode_id String @db.Uuid + likes CommentLike[] + audit_logs CommentAuditLog[] + reports CommentReport[] + @@map("comments") +} + +model CommentLike { + user_id String @db.Uuid + comment_id String @db.Uuid + type like_type + created_at DateTime @default(now()) @db.Timestamptz() + + user User @relation(fields: [user_id], references: [id]) + comment Comment @relation(fields: [comment_id], references: [id]) + @@id([user_id, comment_id]) + @@map("comment_likes") +} + +model CommentAuditLog { + id String @id @db.Uuid @default(uuid(7)) + comment Comment @relation(fields: [comment_id], references: [id]) + performed_by User @relation(fields: [performed_by_id], references: [id]) + action audit_action + created_at DateTime @default(now()) @db.Timestamptz() + + comment_id String @db.Uuid + performed_by_id String @db.Uuid + @@map("comment_audit_logs") +} + +model CommentReport { + id String @id @db.Uuid @default(uuid(7)) + reporter User @relation(fields: [reporter_id], references: [id]) + comment Comment @relation(fields: [comment_id], references: [id]) + title String @db.VarChar(115) + status status_submission + description String? @db.Text + reported_at DateTime @default(now()) @db.Timestamptz() + closed_at DateTime? @db.Timestamptz() + + reporter_id String @db.Uuid + comment_id String @db.Uuid + @@map("comment_reports") +} + + + +/** + * ---------------------------------- + * Model for System Apps and related entities + * ---------------------------------- + */ +model ProvisionedUser { + provisioned_by User @relation(fields: [admin_id], references: [id], name: "ProvisionedUserAdmin") + provisioned_to User @relation(fields: [user_id], references: [id], name: "ProvisionedUserUser") + provisioned_at DateTime @default(now()) @db.Timestamptz() + reason String? @db.VarChar(255) + + admin_id String @db.Uuid + user_id String @db.Uuid + @@id([admin_id, user_id]) + @@map("provisioned_users") +} + +model Country { + id String @id @db.Uuid @default(uuid(7)) + name String @db.VarChar(155) + slug String @db.VarChar(165) + code String @db.VarChar(3) + flag String? @db.VarChar(255) + banner String? @db.VarChar(255) + + UserCountry User[] @relation("UserCountry") + UserCountryPreference UserCountryPreference[] + Media Media[] + @@map("countries") +} + +model HomeMediaBanner { + id String @id @db.Uuid @default(uuid(7)) + media Media @relation(fields: [media_id], references: [id]) + created_by User @relation(fields: [created_by_id], references: [id]) + priority Int @db.SmallInt @unique + start_show DateTime @db.Date + end_show DateTime @db.Date + created_at DateTime @default(now()) @db.Timestamptz() + + media_id String @db.Uuid + created_by_id String @db.Uuid + @@map("home_media_banners") +} \ No newline at end of file diff --git a/structure.example.md b/structure.example.md deleted file mode 100644 index b2f7c0a..0000000 --- a/structure.example.md +++ /dev/null @@ -1,16 +0,0 @@ -src/ -└── modules/ -└── movie/ -├── controller/ -│ ├── createMovie.controller.ts -│ ├── getAllMovies.controller.ts -│ ├── getSimilarByGenre.controller.ts -├── services/ -│ ├── createMovie.service.ts -│ ├── getAllMovies.service.ts -│ ├── getSimilarByGenre.service.ts -├── movie.model.ts -├── movie.repository.ts -├── movie.schema.ts -├── movie.types.ts -└── index.ts