hestia/prisma/schema.prisma
Baobeld 0f95f330ef
Create Residents table (#78)
* add resident table

* update prisma

* toc

* ignore md
2025-02-07 16:30:12 -05:00

83 lines
No EOL
1.7 KiB
Text

// 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"
}
generator pothos {
provider = "prisma-pothos-types"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
model User {
id String @default(uuid())
clerkId String
tenant Tenant @relation(fields: [tenantId], references: [id])
tenantId String
email String?
name String
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@id([id, tenantId])
@@unique([clerkId, tenantId])
}
model Resident {
id String @id @default(uuid())
tenant Tenant @relation(fields: [tenantId], references: [id])
tenantId String
name String
phoneNumber String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Tenant {
id String @id @default(uuid())
clerkOrganizationId String @unique
users User[]
residents Resident[]
tenantConfig TenantConfig?
name String
slug String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model TenantConfig {
id String @id @default(uuid())
tenant Tenant @relation(fields: [tenantId], references: [id])
tenantId String @unique
twilioConfig TwilioConfig?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model TwilioConfig {
id String @id @default(uuid())
tenantConfig TenantConfig @relation(fields: [tenantConfigId], references: [id])
tenantConfigId String @unique
accountSID String
authToken String
phoneNumber String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}