cal/prisma/schema.prisma

73 lines
1.8 KiB
Plaintext
Raw Normal View History

2021-03-22 10:48:48 -03:00
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model EventType {
id Int @default(autoincrement()) @id
title String
2021-04-28 09:24:16 -03:00
slug String
2021-03-22 10:48:48 -03:00
description String?
locations Json?
2021-03-22 10:48:48 -03:00
length Int
2021-04-28 06:23:30 -03:00
hidden Boolean @default(false)
2021-03-22 10:48:48 -03:00
user User? @relation(fields: [userId], references: [id])
userId Int?
}
model Credential {
id Int @default(autoincrement()) @id
type String
key Json
user User? @relation(fields: [userId], references: [id])
userId Int?
}
model User {
id Int @default(autoincrement()) @id
username String?
name String?
email String? @unique
2021-03-24 12:03:04 -03:00
password String?
2021-03-22 10:48:48 -03:00
bio String?
avatar String?
timeZone String @default("Europe/London")
weekStart String? @default("Sunday")
2021-04-13 13:16:32 -03:00
startTime Int @default(0)
endTime Int @default(1440)
2021-03-22 10:48:48 -03:00
createdDate DateTime @default(now()) @map(name: "created")
eventTypes EventType[]
credentials Credential[]
teams Membership[]
2021-03-22 10:48:48 -03:00
@@map(name: "users")
}
model Team {
id Int @default(autoincrement()) @id
name String?
members Membership[]
}
enum MembershipRole {
MEMBER
OWNER
}
model Membership {
teamId Int
userId Int
accepted Boolean @default(false)
role MembershipRole
team Team @relation(fields: [teamId], references: [id])
user User @relation(fields: [userId], references: [id])
@@id([userId,teamId])
2021-03-22 10:48:48 -03:00
}