Files
memestream/prisma/schema.prisma
T

53 lines
1.2 KiB
Plaintext

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")
}