mirror of
https://github.com/SrIzan10/echospace.git
synced 2026-06-06 00:56:54 +00:00
73 lines
1.9 KiB
Plaintext
73 lines
1.9 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
githubId String @unique
|
|
username String
|
|
installations String[]
|
|
projects Project[] @relation("UserProjects")
|
|
sessions Session[]
|
|
UserProject UserProject[]
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
expiresAt DateTime
|
|
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model Project {
|
|
id String @id @default(cuid())
|
|
name String
|
|
description String
|
|
github String?
|
|
githubInstallationId String?
|
|
customData String[]
|
|
rateLimitReq Int @default(5)
|
|
rateLimitTime Int @default(60)
|
|
// 8 digit random number
|
|
inviteCode String @unique @default(dbgenerated("floor(random() * 90000000 + 10000000)::text"))
|
|
|
|
users User[] @relation("UserProjects")
|
|
feedback Feedback[]
|
|
UserProject UserProject[]
|
|
}
|
|
|
|
model UserProject {
|
|
userId String
|
|
projectId String
|
|
isOwner Boolean @default(false)
|
|
user User @relation(fields: [userId], references: [id])
|
|
project Project @relation(fields: [projectId], references: [id])
|
|
|
|
@@id([userId, projectId])
|
|
@@index([userId])
|
|
@@index([projectId])
|
|
}
|
|
|
|
model Feedback {
|
|
id Int @id @default(autoincrement())
|
|
message String
|
|
customData String
|
|
projectId String
|
|
project Project @relation(fields: [projectId], references: [id])
|
|
|
|
@@index([projectId])
|
|
}
|