50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Get a free hosted Postgres database in seconds: `npx create-db`
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model Channel {
|
|
id String @id
|
|
name String
|
|
description String?
|
|
isAdult Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
videos Video[]
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
username String @unique
|
|
passwordHash String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Video {
|
|
id String @id
|
|
channelId String
|
|
title String
|
|
description String?
|
|
videoFilename String
|
|
videoMimeType String
|
|
videoSizeBytes Int
|
|
thumbnailFilename String?
|
|
thumbnailMimeType String?
|
|
publishedAt DateTime @default(now())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
channel Channel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([publishedAt(sort: Desc)])
|
|
}
|