2023-04-06 09:12:49 +00:00
|
|
|
// 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"
|
2023-05-23 12:00:39 +00:00
|
|
|
binaryTargets = ["linux-musl", "debian-openssl-3.0.x"]
|
2023-04-06 09:12:49 +00:00
|
|
|
previewFeatures = ["postgresqlExtensions"]
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
extensions = [postgis]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Ad {
|
2023-05-11 15:47:55 +00:00
|
|
|
uuid String @id @db.Uuid
|
2023-04-25 15:49:47 +00:00
|
|
|
driver Boolean
|
|
|
|
passenger Boolean
|
2023-05-11 15:47:55 +00:00
|
|
|
frequency Frequency
|
2023-04-25 15:49:47 +00:00
|
|
|
fromDate DateTime @db.Date
|
|
|
|
toDate DateTime @db.Date
|
2023-08-16 10:28:20 +00:00
|
|
|
schedule ScheduleItem[]
|
|
|
|
seatsProposed Int @db.SmallInt
|
|
|
|
seatsRequested Int @db.SmallInt
|
|
|
|
strict Boolean
|
2023-05-11 15:47:55 +00:00
|
|
|
driverDuration Int?
|
|
|
|
driverDistance Int?
|
|
|
|
passengerDuration Int?
|
|
|
|
passengerDistance Int?
|
2023-04-25 15:49:47 +00:00
|
|
|
waypoints Unsupported("geography(LINESTRING)")?
|
|
|
|
direction Unsupported("geography(LINESTRING)")?
|
|
|
|
fwdAzimuth Int
|
|
|
|
backAzimuth Int
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2023-04-06 09:12:49 +00:00
|
|
|
|
|
|
|
@@index([driver])
|
|
|
|
@@index([passenger])
|
2023-04-25 15:49:47 +00:00
|
|
|
@@index([fromDate])
|
|
|
|
@@index([toDate])
|
|
|
|
@@index([fwdAzimuth])
|
2023-04-06 09:12:49 +00:00
|
|
|
@@index([direction], name: "direction_idx", type: Gist)
|
|
|
|
@@map("ad")
|
|
|
|
}
|
2023-05-11 15:47:55 +00:00
|
|
|
|
2023-08-16 10:28:20 +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")
|
|
|
|
}
|
|
|
|
|
2023-05-11 15:47:55 +00:00
|
|
|
enum Frequency {
|
|
|
|
PUNCTUAL
|
|
|
|
RECURRENT
|
|
|
|
}
|