airsoft-search/prisma/schema.prisma

58 lines
1.6 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 Organisation {
id String @id @default(uuid())
name String @unique
description String?
logo String?
type String?
tag String?
slug String?
members UserOnOrganisation[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model User {
id String @id @default(uuid())
userId String
email String
name String?
slug String?
organisations UserOnOrganisation[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Role {
id String @id @default(uuid())
name String @unique
usersOnOrganisations UserOnOrganisation[]
}
model UserOnOrganisation {
userId String
organisationId String
roleId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
organisation Organisation @relation(fields: [organisationId], references: [id], onDelete: Cascade)
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
@@id([userId, organisationId, roleId])
}