// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { provider = "prisma-client-js" } datasource db { provider = "mongodb" url = env("DATABASE_URL") } model Account { id String @id @default(auto()) @map("_id") @db.ObjectId userId String @db.ObjectId type String provider String providerAccountId String refresh_token String? access_token String? expires_at Int? token_type String? scope String? id_token String? session_state String? user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([provider, providerAccountId]) @@index([userId]) } model Session { id String @id @default(auto()) @map("_id") @db.ObjectId sessionToken String @unique userId String @db.ObjectId expires DateTime user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@index([userId]) } model User { id String @id @default(auto()) @map("_id") @db.ObjectId email String? @unique emailVerified DateTime? credit Int @default(100) active Boolean @default(false) plan String @default("0") name String? image String? accounts Account[] sessions Session[] ActiveCodeWithUser ActiveCodeWithUser[] ShareNote ShareNote[] Collaboration Collaboration[] } model VerificationToken { id String @id @default(auto()) @map("_id") @db.ObjectId identifier String token String @unique expires DateTime @@unique([identifier, token]) } model ActiveCodeWithUser { id String @id @default(auto()) @map("_id") @db.ObjectId userId String @db.ObjectId code String expires DateTime createdAt DateTime updatedAt DateTime @updatedAt user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@index([userId]) } model ShareNote { id String @id @default(auto()) @map("_id") @db.ObjectId userId String @db.ObjectId localId String data String click Int @default(0) keeps Int @default(0) createdAt DateTime updatedAt DateTime @updatedAt deletedAt DateTime? user User @relation(fields: [userId], references: [id], onDelete: Cascade) } model Collaboration { id String @id @default(auto()) @map("_id") @db.ObjectId userId String @db.ObjectId localId String roomId String title String click Int @default(0) expired DateTime? createdAt DateTime updatedAt DateTime @updatedAt deletedAt DateTime? user User @relation(fields: [userId], references: [id], onDelete: Cascade) }