mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
switch to prisma
This commit is contained in:
110
prisma/schema.prisma
Normal file
110
prisma/schema.prisma
Normal file
@@ -0,0 +1,110 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgres"
|
||||
url = env("POSTGRES_URI")
|
||||
}
|
||||
|
||||
model AdditionalCosts {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
value Decimal
|
||||
Bill Bill[]
|
||||
}
|
||||
|
||||
enum BillStatus {
|
||||
UNINVOICED
|
||||
INVOICED
|
||||
PAID
|
||||
}
|
||||
|
||||
model Bill {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
milageEnd Int
|
||||
milageStart Int
|
||||
status BillStatus @default(UNINVOICED)
|
||||
tarif Decimal
|
||||
additionalCosts AdditionalCosts[]
|
||||
booking Booking?
|
||||
}
|
||||
|
||||
enum BookingStatus {
|
||||
REQUESTED
|
||||
CONFIRMED
|
||||
REJECTED
|
||||
CANCELED
|
||||
}
|
||||
|
||||
model Booking {
|
||||
id String @id @default(uuid())
|
||||
uuid String @unique @default(uuid())
|
||||
createdAt DateTime @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
bill Bill? @relation(fields: [billId], references: [id], onDelete: Cascade)
|
||||
billId Int @unique
|
||||
calendarEventId String?
|
||||
city String
|
||||
destination String
|
||||
email String
|
||||
endDate String
|
||||
name String
|
||||
org String
|
||||
phone String
|
||||
purpose String
|
||||
startDate String
|
||||
status BookingStatus @default(REQUESTED)
|
||||
street String
|
||||
zip String
|
||||
|
||||
@@index([uuid], map: "uuid_1")
|
||||
}
|
||||
|
||||
// next-auth
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String? @db.Text
|
||||
access_token String? @db.Text
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? @db.Text
|
||||
session_state String?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String @unique
|
||||
expires DateTime
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
Reference in New Issue
Block a user