generator client { provider = "prisma-client-js" // include for node docker image binaryTargets = ["native", "debian-openssl-1.1.x"] } datasource db { provider = "postgresql" url = env("POSTGRES_URL") } model Attachment { id BigInt @id msgId BigInt channelId BigInt memeId String @unique @db.Uuid meme Meme @relation(fields: [memeId], references: [id], onDelete: Restrict) url String contentType String message Json guild Json channel Json vision Json createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @@index([channelId]) @@map("attachments") } model Meme { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid url String text String tags Json createdAt DateTime @default(now()) updatedAt DateTime @default(now()) // required to prevent the same attachment being uploaded multiple times // nullable because maybe will have memes that don't come from a discord attachment attachmentId BigInt? @unique attachment Attachment? @@map("memes") } model ChannelHistory { id BigInt @id earliestMessageId BigInt latestMessageId BigInt // we do this because you have to always wrap table names in "" if they have capitals @@map("channelhistory") }