tasko/prisma/schema.prisma
2024-03-15 17:01:41 -04:00

105 lines
2.1 KiB
Text

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DATABASE_DIRECT_URL")
relationMode = "prisma"
}
model Board {
id String @id @default(uuid())
orgId String
title String
imageId String
imageThumbUrl String @db.Text
imageFullUrl String @db.Text
imageUserName String @db.Text
imageLinkHTML String @db.Text
lists List[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model List {
id String @id @default(uuid())
title String
order Int
boardId String
board Board @relation(fields: [boardId], references: [id], onDelete: Cascade)
cards Card[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([boardId])
}
model Card {
id String @id @default(uuid())
title String
order Int
description String? @db.Text
dueDate DateTime?
startedAt DateTime?
listId String
list List @relation(fields: [listId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([listId])
}
enum ACTION {
CREATE
UPDATE
DELETE
}
enum ENTITY_TYPE {
BOARD
LIST
CARD
}
model AuditLog {
id String @id @default(uuid())
orgId String
action ACTION
entityId String
entityType ENTITY_TYPE
entityTitle String
userId String
userImage String @db.Text
userName String @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model OrgLimit {
id String @id @default(uuid())
orgId String @unique
count Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model OrgSubscription {
id String @id @default(uuid())
orgId String @unique
stripeCustomerId String? @unique @map(name: "stripe_customer_id")
stripeSubscriptionId String? @unique @map(name: "stripe_subscription_id")
stripePriceId String? @map(name: "stripe_price_id")
stripeCurrentPeriodEnd DateTime? @map(name: "stripe_current_period_end")
}