ad/prisma/schema.prisma

78 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
2023-06-02 07:49:19 +00:00
provider = "prisma-client-js"
binaryTargets = ["linux-musl", "debian-openssl-3.0.x"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Ad {
2023-07-25 14:52:41 +00:00
uuid String @id @default(uuid()) @db.Uuid
userUuid String @db.Uuid
2023-12-06 14:51:46 +00:00
status Status @default(PENDING)
2023-05-11 15:42:43 +00:00
driver Boolean
passenger Boolean
frequency Frequency
2023-07-25 14:52:41 +00:00
fromDate DateTime @db.Date
toDate DateTime @db.Date
schedule ScheduleItem[]
seatsProposed Int @db.SmallInt
seatsRequested Int @db.SmallInt
2023-05-11 15:42:43 +00:00
strict Boolean
2023-07-25 14:52:41 +00:00
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
waypoints Waypoint[]
comment String?
@@map("ad")
}
2023-07-25 14:52:41 +00:00
model ScheduleItem {
uuid String @id @default(uuid()) @db.Uuid
adUuid String @db.Uuid
day Int
time DateTime @db.Time(4)
margin Int
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade)
@@map("schedule_item")
}
model Waypoint {
2023-05-11 15:42:43 +00:00
uuid String @id @default(uuid()) @db.Uuid
adUuid String @db.Uuid
position Int @db.SmallInt
lon Decimal @db.Decimal(9, 6)
lat Decimal @db.Decimal(8, 6)
2023-05-10 12:37:00 +00:00
name String?
houseNumber String?
street String?
locality String?
postalCode String?
2023-05-11 15:42:43 +00:00
country String
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade)
@@map("waypoint")
}
enum Frequency {
PUNCTUAL
RECURRENT
}
2023-12-06 14:51:46 +00:00
enum Status {
PENDING
VALID
INVALID
SUSPENDED
}