124_webcalibre2/prisma/schema.prisma

76 lines
No EOL
2 KiB
Text

datasource db {
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id @default(uuid())
name String? // Renamed from displayName for NextAuth compatibility
email String @unique
emailVerified DateTime?
image String?
azureAdUserId String? @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
nodes FileNode[]
accounts Account[]
sessions Session[]
}
model Account {
id String @id @default(uuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
}
model Session {
id String @id @default(uuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model FileNode {
id String @id @default(uuid())
name String
size BigInt?
isFolder Boolean @default(false)
oneDriveId String? @unique
path String
orderIndex Int @default(0)
metadata Json @default("{}")
description String?
ownerId String
owner User @relation(fields: [ownerId], references: [id])
parentId String?
parent FileNode? @relation("TreeHierarchy", fields: [parentId], references: [id])
children FileNode[] @relation("TreeHierarchy")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([ownerId, path])
@@index([parentId])
@@index([orderIndex])
}