generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model Author { sec_uid String @id uid String? @unique nickname String signature String? avatar_url String? follower_count BigInt @default(0) total_favorited BigInt @default(0) unique_id String? short_id String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt imagePosts ImagePost[] videos Video[] } model Video { aweme_id String @id desc String preview_title String? duration_ms Int created_at DateTime share_url String digg_count BigInt @default(0) comment_count BigInt @default(0) share_count BigInt @default(0) collect_count BigInt @default(0) authorId String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt tags String[] video_url String height Int? width Int? cover_url String? fps Int? raw_json Json? comments Comment[] author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade) transcript VideoTranscript? @@index([authorId]) @@index([created_at]) } model CommentUser { id String @id @default(cuid()) nickname String avatar_url String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt comments Comment[] @@unique([nickname, avatar_url]) } model Comment { cid String @id text String digg_count BigInt @default(0) created_at DateTime videoId String? userId String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt imagePostId String? imagePost ImagePost? @relation(fields: [imagePostId], references: [aweme_id], onDelete: Cascade) user CommentUser @relation(fields: [userId], references: [id], onDelete: Cascade) video Video? @relation(fields: [videoId], references: [aweme_id], onDelete: Cascade) images CommentImage[] @@index([videoId, created_at]) @@index([imagePostId, created_at]) } model CommentImage { id String @id @default(cuid()) commentId String url String order Int width Int? height Int? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt comment Comment @relation(fields: [commentId], references: [cid], onDelete: Cascade) @@unique([commentId, order]) @@index([commentId, order]) } model ImagePost { aweme_id String @id desc String created_at DateTime share_url String digg_count BigInt @default(0) comment_count BigInt @default(0) share_count BigInt @default(0) collect_count BigInt @default(0) authorId String tags String[] music_url String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt raw_json Json? comments Comment[] images ImageFile[] author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade) @@index([authorId]) @@index([created_at]) } model ImageFile { id String @id @default(cuid()) postId String url String order Int width Int? height Int? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt animated String? duration Int? post ImagePost @relation(fields: [postId], references: [aweme_id], onDelete: Cascade) @@unique([postId, order]) @@index([postId, order]) } model VideoTranscript { id String @id @default(cuid()) videoId String @unique speech_detected Boolean language String? audio_type String? transcript String[] non_speech_summary String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt transcript_zh_tsv Unsupported("tsvector")? video Video @relation(fields: [videoId], references: [aweme_id], onDelete: Cascade) @@index([videoId]) @@index([transcript_zh_tsv], map: "video_transcript_zh_idx", type: Gin) }